Docker Notes basic commands in docker

Posted on Jan. 6, 2020
docker
1005

Docker starting nginx Web Server

docker container run --publish 80:80 nginx

run as detach mode

docker container run --publish 80:80 --detach nginx

giving a name to container

docker container run --publish 80:80 --detach --name webhost nginx

 

docker container logs webhost

docker container top webhost # gives prcesses running in container

 

run apache server

docker container run -d -p 3307:3306 --name mysql_db -e MYSQL_RANDOM_ROOT_PASSWORD=True mysql:5.7

run mysql server

docker container run -d -p 8080:80 --name webserver httpd

 

 

Docker Networking

Each container connected to a private virtual network bridge

Each Virtual network routes through NAT firewall on host IP

docker container run -p 80:80 --name proxy -d nginx

docker container port proxy

docker container inspect --format '{{ .NetworkSettings.IPAddress }}' proxy

 

Show networks docker network ls

inspect a nt docker network inspect

create docker network create --driver

attach docker network connect

detach docker network disconnect

 

docker network create test_network
docker run -d --name webhost nginx
docker run -d --name --network test_network nginx
docker network connect test_network webhost

 

Docker Networking : DNS

 




0 comments

Please log in to leave a comment.