BaşlayınÜcretsiz Başlayın

Overriding ARG in a build

The ARG Dockerfile instruction allows us to set a variable in a Dockerfile and then optionally override it when building an image. We've added a Dockerfile to your current working directory with the following instructions:

FROM ubuntu
ARG WELCOME_TEXT=Hello!
RUN echo $WELCOME_TEXT
CMD echo $WELCOME_TEXT

The Dockerfile adds an ARG named WELCOME_TEXT, which is then printed during the build. The same text is printed when a container is started from the image.

Bu egzersiz

Introduction to Docker

kursunun bir parçasıdır
Kursu Görüntüle

Egzersiz talimatları

  • Using the terminal, enter the command to build the Dockerfile and set the WELCOME_TEXT variable to Welcome!.

Uygulamalı interaktif egzersiz

İnteraktif egzersizlerimizden biriyle teoriyi pratiğe dökün

Egzersizi başlat