DevOps Classroom notes 05/Jun/2026

Docker networking

  • docker network subcommand has options to deal with docker network
  • docker has following network drivers
    • host
    • bridge
    • overlay
    • none
  • The default network driver is bridge, i.e. when you create containers the contianer will be part of default docker network
  • The default bridge network allows containers to communicate over ip but name resolution cannot be done
  • The name resolution is possible when you create your own bridge network
  • Host driver means your container gets an ip of the host
  • Generally when we create a network you can also specify network range
  • Docker also supports multi host network using docker swarm and the network driver will be overlay.

Scenario

  • I have the following application
  • The idea is to run this application in containers
    • webstore => reactjs application
    • storeapi => fastapi
    • db => postgresdb
  • We need to build docker images for
    • webstore
    • storeapi
  • We need to ensure the containers can communicate with each other which requires us to create network
    • Generally identifying by name is more sensible
  • We have a database i.e. it will store data which requires us to deal with volumes
  • Steps:
    • create network
    • create volume
    • launch containers one by one
      • db
      • service
      • webstore
  • Roughly the commands to create
docker network create -d bridge store_net
docker volume create store_vol
docker run -d -v store_vol:/var/lib/psql --name storedb --network store_net postgres:19
docker run -d --name storeservice --network store_net storeservice:1.0
docker run -d --name webstore -P --network store_net webstore:1.0
  • Now if we get new code changes
# rebuild images
docker image build -t storeservice:1.1 src/service
docker image build -t webstore:1.1 src/frontend

docker rm -f webstore storeservice
docker run -d --name storeservice --network store_net storeservice:1.1
docker run -d --name webstore -P --network store_net webstore:1.1
  • Refer Here for additional networking references
  • Exercise: Create contianers with specific cpu and ram Refer Here
Published
Categorized as Uncategorized Tagged

By continuous learner

devops & cloud enthusiastic learner

Leave a ReplyCancel reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Please turn AdBlock off
Social Media Icons Powered by Acurax Web Design Company

Discover more from Direct DevOps from Quality Thought

Subscribe now to keep reading and get access to the full archive.

Continue reading

Exit mobile version
%%footer%%