πDocker
Manage Images
List all images that are locally stored with the Docker Engineβ¨
docker image ls
docker images
Download an image
docker pull IMAGE[:TAG]
Upload an image
docker push IMAGE
Delete an image
docker rmi IMAGE
Delete dangling image / All unused images
docker image prune
docker image prune -a
Build an image from a Dockerfile
docker build DIRECTORY
Build and Tag an image from a Dockerfile
docker build -t IMAGE DIRECTORY
Run a new container
Start a new container from an image / With a name / With a mapped port / All mapped ports
docker run IMAGE
docker run --name MY_CONTAINER IMAGE
docker run -p HOSTPORT:CONTAINERPORT IMAGE
docker run -P IMAGE
Start a container in background
docker run -d IMAGE
Start a container with a hostname
docker run --hostname HOSTNAME IMAGE
Start a container and map a local directory into the container
docker run -v HOSTDIR:TARGETDIR IMAGE
Manage Containers
List running container
docker ps
List all container
docker ps -a
Delete a container / Running container / Stopped containers
docker rm CONTAINER
docker rm -f CONTAINER
docker container prune
Start a stopped container
docker start CONTAINER
Copy a file from a container to the host
docker cp CONTAINER:SOURCE TARGET
Copy a file from the host to the container
docker cp TARGET CONTAINER:SOURCE
Start a shell in a running container
docker exec -it CONTAINER EXECUTABLE
Rename a container
docker rename OLD_NAME NEW_NAME
Information & Statistics
Show the logs of a container
docker logs CONTAINER
Show stats of running containers
docker stats
Show processes of container
docker top CONTAINER
Show all modified files in a container
docker diff CONTAINER
Show mapped port of a container
docker port CONTAINER
Resources
Last updated