Pages

Saturday 4 December 2021

Docker

Basic commands

$ docker login -u username -p mypassword this-is-my-docker-registry.com # Log in to a docker repo

$ docker images # list images

$ docker ps # list all running docker containers

$ docker ps -a # list all containers, including stopped.

$ docker rmi image-name #remove an image

$ docker pull image:tag #pulls an image 

$ docker build -t image:tag --build-arg arg1=value --build-arg arg2=value -f myDockerFile.alpine context-dir/ #build image from DockerFile

$ docker save -o image.tar image:tag  # save the image as a tar file

$ docker load -i /image-tar-file.tar.gz # loads the image from tar file

docker ps --size # get size of container

$ docker system prune $ prune dangling images/containers

$ docker image prune -a $ pruner all dangling images

$ docker system df #The docker system df command displays information regarding the amount of disk space used by the docker daemon.


Change docker root dir

vi /etc/docker/daemon.json

From <https://stackoverflow.com/questions/32070113/how-do-i-change-the-default-docker-container-location/50726177> 
 
{
  "data-root":"/scratch1/docker"
}

No comments:

Post a Comment