How to get Docker containers to communicate by name instead of ip-address`?

Docker adding all new containers default to a bridge network but on the default bridge network you only can communicate between containers with ip-address, to communicate with containers name instead you need to define your own bridge network:

docker network create --driver bridge network01 --subnet=

Then when you run the container add –network network01 to let the container connect to the new network and you can then communicate between containers by using the name you set on the container instead of communicate by ip-address that changes after a reboot and other things.

Setup a MS SQL Server on Docker

I have started to learn Docker and a nice one liner to have saved somewhere is this one that setting up a docker container with MS SQL server and a SA password + setting up a docker volume to hold the data for MS SQL Server.

The one-line:

docker run -e 'ACCEPT_EULA=Y' -e 'MSSQL_SA_PASSWORD=<YourStrong@Passw0rd>' -p 1433:1433 -v sqlvolume:/var/opt/mssql --name sql1 --hostname sql1 -d

Reference information can be found on