Docker networking
- Lets create two docker containers
- Refer Here for formatting the outputs of inspect section
- Now lets find their ip addresses
- Now lets get the ip address of the host (machine where is docker is installed)
- Lets find if the container can be pinged from the host
- Lets find if the networking between two containers is working or not
- Containers by default can communicate with each other using ip addresses but not by names.
- The bridge network is created by default when we install docker
- Lets create a new bridge network
- create two containers on the new bridge network
- The corrected version of nopcomerce
FROM mcr.microsoft.com/dotnet/aspnet:6.0
ADD https://github.com/nopSolutions/nopCommerce/releases/download/release-4.50.3/nopCommerce_4.50.3_NoSource_linux_x64.zip /Nop/nopCommerce_4.50.3_NoSource_linux_x64.zip
WORKDIR /Nop
RUN apt update && apt install unzip -y && mkdir /Nop/bin && mkdir /Nop/logs && unzip ./nopCommerce_4.50.3_NoSource_linux_x64.zip
EXPOSE 80
CMD ["/usr/bin/dotnet", "/Nop/Nop.Web.dll"]
Exercise
- Try create mysql and phpmyadmin in the same network and establish connection using host name (Create a bridge network)