Skip to content

Latest commit

 

History

History
87 lines (76 loc) · 1.85 KB

docker_cheatsheets.md

File metadata and controls

87 lines (76 loc) · 1.85 KB

My cheatsheets for docker

Show images see documentation

docker images -a

Show imgaes before one image

docker images --filter "before=image1"

Show images since one image

docker images --filter "since=image3"

Delete one image

docker image rm <imagename>

Delete images by list

docker image rm -f $(docker images --format "{{.ID}}" )

Delete all images link to documentation

docker image prune
#or
docker image prune --all

Delete all images with exclude some others See documentation

docker image prune -a --force --filter "until=2017-01-04T00:00:00"
#or
docker image prune --filter="label=deprecated"
#or
 docker image prune --filter="label!=maintainer=john"

Delete all untagged images

docker rmi $(docker images -f "dangling=true" -q)

Delete all containers

docker rm -f $(docker ps -a -q)

Publish port from container to host, for example use: http://localhost:5001 or use: http://localhost:10001

docker run -d -ti --publish 5001:5001 a02ecc649843
#or
docker run -ti -p 8080:10001 --name <container name> <name>:<tag>
            <container:host>

Build from Dockerfile (Remember about target - for example "." if Dockerfile is in current directory!

docker build -t "<name>:<tag>" .

My cheatsheets for docker-compose

build and run docker containers using docker-compose

docker-compose up --build -d

stop and delete containers, run in previous step

docker-compose rm -fs