RonakThakkar
4/11/2018 - 9:31 PM

Docker - Linux

enter into unix image
vagrant ssh

List current directory contents
ls

List root directory contents
ls &

cd /vagrant
log into vagrant directory which is mapped to host machine

docker build -t ronakthakkar/consoleapp:1 .
docker push ronakthakkar/consoleapp:1

Get IP Address
windows = ipconfig
linux = netstat -rn

Ping a host and port
telnet {host} {port}
https://www.cyberciti.biz/faq/ping-test-a-specific-port-of-machine-ip-address-using-linux-unix/

Ping machine
ping IPAddress

docker exec -it platform-mongodb mongo version

Enter into docker container to execute command
docker exec -it platform-mongodb /bin/bash

docker container remove all
docker stop $(docker ps -a -q)
docker rm $(docker ps -a -q)

Get IP Address of host from docker container
docker run -it alpine
route|awk '/default/ { print $3 }'
ping ipaddress

Access host machine from docker container in "Docker for Windows"
http://docker.for.win.localhost:80

docker curl
docker run --rm byrnedo/alpine-curl https://wwwo.google.com

get ip address of docker container from host
docker inspect -f '{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' container_id_or_name

get ip address of all running docker containers
Note = -q returns only name

docker inspect --format='{{.Name}} - {{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' $(docker ps -q)
docker inspect --format='{{.Name}} - {{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' $(docker container ls -q)