Show pageOld revisionsBacklinksBack to top This page is read only. You can view the source, but not change it. Ask your administrator if you think this is wrong. <nav type="pills" justified="false"> * [[:user_manuals|Back to Documentation]] * [[:technical:docker-lab-basic|Docker Lab - Basic]] </nav> ----- ====== Description ====== * We start out with a very basic Docker lab to build out confidence. * Two plain Nginx containers. * Run them on a bridge called **test-radiusdesk** * Reach them on ports 8000 and 8001 respectively from the host Linux system laptop running Docker. ====== 1. Create the bridge ====== * Create the bridge <code bash> docker network create test-radiusdesk #This was the result f67e11184a174cf7fb82ba85734dd6d895f0690738cb07246fd7ee13b0024761 </code> * Confirm it was created: <code bash> docker network ls #This was the result NETWORK ID NAME DRIVER SCOPE 395e31953e3c bridge bridge local 0d8b3aa905bf host host local 17e0830302a8 none null local f67e11184a17 test-radiusdesk bridge local </code> * If you issue the //ip a// command it will be listed there (Look for the NETWORK ID) <code bash> 17: br-f67e11184a17: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc noqueue state DOWN group default link/ether fe:67:4b:58:62:66 brd ff:ff:ff:ff:ff:ff inet 172.20.0.1/16 brd 172.20.255.255 scope global br-f67e11184a17 valid_lft forever preferred_lft forever </code> ====== 2.Run two nginx containers on that bridge ====== * Issue the following commands (We will use //docker up// first) <code bash> # Container 1 -> host port 8000 docker run -d --name nginx-8000 --network test-radiusdesk -p 8000:80 nginx # Container 2 -> host port 8001 docker run -d --name nginx-8001 --network test-radiusdesk -p 8001:80 nginx </code> * What that does: * --network test-radiusdesk plugs both into your custom bridge * -p 8000:80 means laptop port 8000 forwards to container port 80 ====== 3. Test from your laptop ====== * Use curl or your browser <code bash> curl http://localhost:8000 curl http://localhost:8001 </code> * Both should show "Welcome to nginx!" ====== 4. Prove they can talk to each other by name (the bridge magic) ====== * Issue this command: <code bash> docker exec -it nginx-8000 ping nginx-8001 </code> * It will resolve! On the default bridge this would NOT work. * Another test: <code bash> docker exec -it nginx-8000 curl http://nginx-8001 </code> * Container 8000 reaching container 8001 internally on port 80, without going through your host ports. ====== Useful cleanup / debug ====== * Some handy commands: <code bash> docker ps # see running docker network inspect test-radiusdesk # see which containers + their IPs docker logs nginx-8000 docker stop nginx-8000 nginx-8001 && docker rm nginx-8000 nginx-8001 docker network rm test-radiusdesk </code> ====== Same thing with docker-compose (cleaner) ====== * Create docker-compose.yml: <code yaml> services: nginx-8000: image: nginx ports: - "8000:80" networks: - test-radiusdesk nginx-8001: image: nginx ports: - "8001:80" networks: - test-radiusdesk networks: test-radiusdesk: driver: bridge </code> * We can then bring it up with: <code bash> docker compose up -d docker compose down </code> technical/docker-lab-basic.txt Last modified: 2026/09/11 21:09by system