Crib Sheet: Important Docker commands
Start
dockerthe Docker deamon on your machine (ECMWF):
Panel | ||||
---|---|---|---|---|
| ||||
sudo |
systemctl |
start |
docker |
|
systemctl |
restart |
docker |
|
systemctl |
status |
docker |
which is actually: sudo /usr/bin/systemctl status docker
Which images are on my machine:
Panel | ||||
---|---|---|---|---|
| ||||
docker |
images |
|
rmi oifs remove image oifs, might need -f option |
Which containers are running:
docker ps
docker ps -a show all containers
docker rm 6skd897asd removes container
Build docker image:
docker build -t <image name> . uses file called Dockerfile
docker build -t <image name> -f <docker file>
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:
docker run -it ubuntu run interactively with tty output
docker run -it oifs
docker run -v /scratch/rd/damk:/scratch:rw -it oifs mount volume $SCRATCH inside container
docker run -v /tmp/.X11-unix:/tmp/.X11-unix -e DISPLAY=unix$DISPLAY metview metview
Use Harbor repository:
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