Skip to content

Latest commit

 

History

History
99 lines (70 loc) · 1.1 KB

cheatsheet-docker.md

File metadata and controls

99 lines (70 loc) · 1.1 KB

docker

Build image

docker image build --tag name:tag --no-cache .

List image

docker image ls

Push to registry

docker image push name:tag

Run docker

docker container run -d name web -p 8080:8080 name:tag

Start/Stop docker container

docker container stop web
docker container start web

Remove docker container

docker container rm web

List container

docker container ls

Show docker containers

docker ps -a

docker-compose:

docker-compose build
docker-compose up
docker—compose up —d —-no—deps [service]
docker-compose down

docker-compose ps
docker-compose stop
docker-compose start
docker-compose rm

Log

docker-compose logs
docker-compose logs --follow
docker-compose logs --tail=5
docker-compose logs [service ...]

Shell into a container

docker exec -it <containerId> sh
docker-compose exec <serviceName> <shell>

Shell into a image

docker run -it image_name sh

Scale container

docker-compose up -d --scale api=4

Clean up

docker system prune