Skip to content

Latest commit

 

History

History
24 lines (22 loc) · 1.09 KB

File metadata and controls

24 lines (22 loc) · 1.09 KB

Common Docker Commands

Here is the list of commonly used Docker commands:

Purpose Command

Build an image

docker build --rm=true .

Install an image

docker pull ${IMAGE}

List of installed images

docker images

List of installed images (detailed listing)

docker images --no-trunc

Remove an image

docker rmi ${IMAGE_ID}

Remove all untagged images

docker rmi $(docker images | grep “^” | awk “{print $3}”)

Remove all images

docker rm $(docker ps -aq)

Run a container

docker run

List containers

docker ps

Stop a container

docker stop ${CID}

Stop all running containers

docker stop docker ps -q

Find IP address of the container

docker inspect --format '{{ .NetworkSettings.IPAddress }}' ${CID}

Attach to a container

docker attach ${CID}

Remove a container

docker rm ${CID}

Remove all containers

docker rm $(docker ps -aq)

Get container id for an image by regular expression

docker ps | grep arungupta/wildfly | awk '{print $1}'