Last active
June 17, 2020 10:49
-
-
Save danilocandido/a86c3092ec767b0c6503e21161ccb3a0 to your computer and use it in GitHub Desktop.
Useful Docker Commands
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# display system-wide information | |
docker info | |
# list containers | |
docker ps # only running | |
docker ps -a # all | |
# remove specific container ID | |
docker rm 42bbb5394617 | |
# remove docker containers | |
docker rm $( docker ps -aq ) # all containers | |
docker rmi $( docker images -aq ) # all containers (docker rmi) | |
docker rmi name:tag -> docker rmi ubuntu:14.04 | |
# stop containers | |
docker stop <container> | |
docker stop $( docker ps -aq ) | |
docker run hello-world # starts a new container | |
# rails logs | |
docker logs -f container_id | |
# interact with bash | |
docker run -it --name temp ubuntu:latest /bin/bash | |
# Ctrl P + Q | |
# DockerHub Build/Push | |
exemplo: https://hub.docker.com/repository/docker/danilocandido/noticias-alura | |
- Entra no dockerhub e cria um novo repositório | |
- Builda a imagem | |
docker build -t noticias-alura . | |
- Cria uma tag apontando para o repositório criado acima | |
docker tag noticias-alura danilocandido/noticias-alura:v1 | |
- Dá o push da imagem criada o docker docker com a tag | |
docker push danilocandido/noticias-alura:v1 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment