Skip to content

Commit

Permalink
Update docker_2.rst
Browse files Browse the repository at this point in the history
  • Loading branch information
toniher authored Oct 9, 2023
1 parent 2fe0f3d commit 3a9e883
Showing 1 changed file with 0 additions and 40 deletions.
40 changes: 0 additions & 40 deletions docs/docker_2.rst
Original file line number Diff line number Diff line change
Expand Up @@ -195,44 +195,6 @@ Difference between ARG and ENV explained `here <https://vsupalov.com/docker-arg-
* **ENV** values: available during the image build process but also for the future running containers.
* It can be checked in a resulting running container by running ``env``.

In the case below **UbuntuVersion** argument is provided with a default value.

.. code-block::
ARG UbuntuVersion=18.04
FROM ubuntu:${UbuntuVersion}
Override the value for **UbuntuVersion** as you build the image with --build-arg:

.. code-block::
docker build --build-arg UbuntuVersion=20.04 .
We try a simple example with ENV

.. code-block::
FROM ubuntu:18.04
ENV PLANET="Earth"
RUN echo ${PLANET}
Enter in the container interactively and check variable ``${PLANET}``

You can pass variable through commandline as well (with ``--env``/``-e``) during running process:

.. code-block:: console
docker run -ti --env PLANET=Mars test
Try to replace the examples above of **ENV** with **ARG** and see what happens.


**CMD, ENTRYPOINT**: command to execute when generated container starts

The ENTRYPOINT specifies a command that will always be executed when the container starts. The CMD specifies arguments that will be fed to the ENTRYPOINT
Expand Down Expand Up @@ -314,8 +276,6 @@ This script outputs random intergers from 1 to 1000: the number of integers sele
FROM centos:7
MAINTAINER Name Surname <[email protected]>
# Copy script from host to image
COPY random_numbers.bash .
Expand Down

0 comments on commit 3a9e883

Please sign in to comment.