Skip to content

Instantly share code, notes, and snippets.

@ncesar
Created July 1, 2020 20:38
Show Gist options
  • Save ncesar/90f52730a10f109a98fb0cb446d7e011 to your computer and use it in GitHub Desktop.
Save ncesar/90f52730a10f109a98fb0cb446d7e011 to your computer and use it in GitHub Desktop.
Docker usefull command list
  1. docker container run -it --name CONTAINERNAME CONTAINERMIMAGE bash(ou sh) => it will run directly the bash of a container

  2. docker container ls => it will show running containers

  3. docker container ls -a => it will show all containers(running or not)

  4. docker container run -p PORTA:PORTA -d(detach) --name NOME -e(env) random_env=true IMAGEM

  5. docker container stats => will show stats about how much ram an image is using

  6. docker container stats CONTAINERNAME => specific stats for a container

  7. docker container inspect CONTAINERNAME => informações do container

  8. docker container top CONTAINERMANE => mostra processos rodando no container

  9. docker container start -ai CONTAINERNAME => starts already created container with a bash

  10. docker container exec -it => run additional proccess(e.g shell/bash) in a running container

@ncesar
Copy link
Author

ncesar commented Jul 3, 2020

  1. docker container port CONTAINERNAME => shows the ports that the container has open
  2. docker container inspect --format "{{ .NetworkSettings.IPAddress }}" CONTAINERNAME => the --format argument let us get a specific line from the .json inspect file.

-------------- docker network --------------
13. docker network ls => shows networks
14. docker network inspect => inspect a network
15. docker network create --driver => create a network
16. docker network connect => attach a network to container
17. docker network disconnect => detach a network from a container

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment