Skip to content

Instantly share code, notes, and snippets.

@thecyberd3m0n
Created July 28, 2018 17:30
Show Gist options
  • Save thecyberd3m0n/7c21c09dd05146ccc0bcbb99356db5c3 to your computer and use it in GitHub Desktop.
Save thecyberd3m0n/7c21c09dd05146ccc0bcbb99356db5c3 to your computer and use it in GitHub Desktop.
Docker commands I want to remember
# build from Dockerfile
`docker build -t <machine_name> .`
# run built machine
`docker run -it <machine_name>`
-d - in background
-P - expose all ports to host
# list all machines
`docker ps -a`
# log into the machine
`docker exec -it <container_id> /bin/bash`
list listened ports inside the container
1. get the PID of contaianer
`docker inspect -f '{{.State.Pid}}' <container_id>`
2. `sudo nsenter -t <PID> -n netstat`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment