forked from biocorecrg/CRG_Containers_June_2022
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
0 additions
and
40 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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 | ||
|
@@ -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 . | ||
|