Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docker #18

Open
daniloab opened this issue Jun 4, 2022 · 0 comments
Open

docker #18

daniloab opened this issue Jun 4, 2022 · 0 comments
Labels

Comments

@daniloab
Copy link
Owner

daniloab commented Jun 4, 2022

Commands

filter

volume

  • docker ps --filter volume=VOLUME_NAME
  • docker build -t image-name . build an image

list

container doc

  • docker container ls

    • flags: -a: all containers
  • all status exited docker ps --filter "status=exited

image

  • docker image ls

remove

  • all containers docker container rm $(docker container ls -aq)
  • all images docker image rm $(docker image ls -aq)
  • all volumes docker volume rm $(docker volume ls -q)
  • docker rm CONTAINER_NAME: delete the container to free disk space
  • docker rmi IMAGE_NAME:TAG: remove image from your computer to free disk space

run

  • docker run -d -p 27017:27017 -v data:/data/db mongo -d: development -v: version

start/stop

  • docker start CONTAINER_NAME
  • docker stop CONTAINER_NAME
  • stop all docker container stop $(docker container ls -aq)

more commands

  • kill all running containers with docker kill $(docker ps -q)
  • delete all stopped containers with docker rm $(docker ps -a -q)
  • delete all images with docker rmi $(docker images -q)
  • date and stop a container that is in a crash-loop with docker update --restart=no && docker stop
  • sh shell into container docker exec -i -t /bin/bash - if bash is not available use /bin/sh
  • sh shell with root if container is running in a different user context docker exec -i -t -u root /bin/bash
@daniloab daniloab added the docker label Jun 4, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant