Created
July 28, 2018 17:30
-
-
Save thecyberd3m0n/7c21c09dd05146ccc0bcbb99356db5c3 to your computer and use it in GitHub Desktop.
Docker commands I want to remember
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
# 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