Docker Networking contd
- By default docker container run on bridge network (default)
- We can create our own bridge networks
- container can be connected to network even after creation.
- Lets create two containers d1 and d2 in default bridge network
docker run --name d1 -d alpine sleep 1d
docker run --name d2 -d alpine sleep 1d

* Now lets inspect container and find ip addresses. Try ping

* Default bridge network allows ip based resolution but not name based resolution
* Where a custom bridge network allow name based resolutions
* Lets create a custom bridge network with range 192.168.0.0/24
docker network create --driver bridge --subnet 192.168.0.0/24 learning

* NOw lets create two container l1 and l2 and try connectivty by name and ip
docker run --name l1 --network learning -d alpine sleep 1d
docker run --name l2 --network learning -d alpine sleep 1d


Nop Commerce with network
- We have a image called as
nop:1.0which is our application and also we have pulled mysql image - lets create a network called as nop-net with range
10.100.0.0/24
docker network create --driver bridge --subnet 10.100.0.0/24 nop-net
- Lets create a volume for database nop-vol
docker volume create nop-vol
- Lets create a database container nopdb in nop-net with nop-vol attached
docker run \
--name nopdb \
--network nop-net \
-e POSTGRES_USER=nop \
-e POSTGRES_PASSWORD=qtdevops \
-e POSTGRES_DB=nop \
-p 5432:5432 \
-d postgres

* Now lets create nop container in nop-net
docker container run -d \
--name nop \
--network nop-net \
-p 80:5000 \
shaikkhajaibrahim/febnop:latest
- To be continued to show the running version
Registry
- Registries are where we store/distribute our images
- Popular Registries
- Docker hub
- Private
- Public Registries
- Azure Container Registy (ACR)
- AWS Elastic Container Registry (ECR)
- GCR
- Jfrog/Artifactory
- Docker hub
- Registries will have repositories where each repo reprsents and application image which will have versions as tags.
- Login into registy
- docker hub
docker login
- docker hub
- Create a tag according to repo


