Communicate between containerized projects
It appeared that I’ve succeeded in containerizing multiple projects. I was wrong as the challenges were endless.
Will the data still be displayed after request/response communication of Client -> API and API -> DB? I simply tried with my normal configuration which didn’t work.
Let’s see how we can prepare them to run in 📦s. Alarming you that I’m still not dealing with docker-compose.
- Connectionstring — write the IP and port (default for MSSQL is 1433, MySQL is 3306). If it’s your machine, state your IP.
.
and (local)
won’t work since the container will look for it’s own dbserver which is not present.
2. URLs — state these using IPs again.
Consider a container as another host in your network. He’ll need to know which host he has to request from.
More Tips
- Tag the image, name the container as a good practice 😊
- To view logs of a container: docker logs -f Container-ID
- To simply copy any file from the running container to your machine: docker cp Container-ID:/foo.txt foo.txt
Previous post: containerizing-an-application-of-multiple-startup-projects-without-docker-compose-visual-studio
Comment if anyone needs help to containerize an Angular app 😉