Crib Sheet: Important Docker commands
Start the Docker deamon on your machine (ECMWF):
Panel | ||||
---|---|---|---|---|
| ||||
sudo systemctl start docker |
which is actually: sudo /usr/bin/systemctl status docker
Which images are on my machine:
Panel | ||||
---|---|---|---|---|
| ||||
docker images |
Which containers are running:
Panel | ||||
---|---|---|---|---|
| ||||
|
Build docker image:
Panel | ||||
---|---|---|---|---|
| ||||
docker build -t <image name> . uses file called Dockerfile |
At ECMWF: docker build -t oifs --build-arg http_proxy="$http_proxy" --build-arg ftp_proxy="$ftp_proxy" --build-arg https_proxy="$https_proxy" --build-arg no_proxy="$no_proxy" .
Run docker images in container:
Panel | ||||
---|---|---|---|---|
| ||||
docker run -it ubuntu run interactively with tty output |
Use Harbor online container registry:
Do this first: docker login eccr.ecmwf.int
The build command below makes an image that can be pushed to harbor: docker build -t eccr.ecmwf.int/openifs/oifs:0.0.1 -f --build-arg http_proxy="$http_proxy" --build-arg ftp_proxy="$ftp_proxy" --build-arg https_proxy="$https_proxy" --build-arg no_proxy="$no_proxy"
Then push it to harbor, manually specifying version number. Careful: Existing version numbers are overwritten! docker push eccr.ecmwf.int/openifs/oifs:0.0.1
Pull image from repository into memory: docker pull eccr.ecmwf.int/openifs/oifs:0.0.1
Dockerfiles
The Dockerfile describe the build process for the Docker image. Examples for several of these files are provided in the OpenIFS git repository.
The naming convention for Dockerfiles is as such:
Panel | ||||
---|---|---|---|---|
| ||||
Dockerfile.oifs<MODELRELEASE>.<GITHASH>.<NOTE>.<ARCH>.<TYPE> MODELRELEASE: A string generated from the IFS cycle, release number and OpenIFS version , e.g. 40r1v2 for CY40R1 OpenIFS release v2. GITHASH: The first five characters of the OpenIFS repository git commit from which this image is built. NOTE: An optional comment string that describes features of this build. ARCH: The architecture for which this image is built, e.g. x86_64, amd64, i386 etc. TYPE: dev, test or bld. bld (build) to be used only for production images, such as from existing OpenIFS releases. dev should be used for images created from development branch commits. |
Example: Dockerfile.oifs40r1v2.41537.user.x86_64.bld
Example Build Process
The following describes the build process of a container image from the Dockerfile.