As a developer, one of the most satisfying moments is finally getting your web app live on the internet for the world to see! However, turning your...
For further actions, you may consider blocking this person and/or reporting abuse
I really liked the way you broke down the process of the front-end, backend and linking them together. I'm pretty new to docker so I didn't quite understand what is docker compose compared to just docker?
Docker compose is a docker too that allow management of deployment of more than one docker application provided they all depends on each other
It just like package.json in NPM,It is a declarative way to use docker.With the help of docker compose, we don't need to run command one by one.
I too love Docker, especially for development environments! No more fussing trying to get all our team members setup on different computers. Just spin up a container, and magically they're working in the same environment!
Nice article! Keep up the great work!
How does this work with ip/domains? For example, are the front end and back end at different HTTP addresses? And how do you get custom domains linked to the front and in the back in separately?
Great question! Here's how Docker containers work with IPs, domains, and linking frontends and backends:
By default, Docker containers get their own virtual IP address assigned by Docker's networking. So your frontend and backend containers would have different IP addresses, like 172.17.0.2 for front-end and 172.17.0.3 for back-end.
You don't necessarily need to expose these default IPs publicly. Instead, you can map custom ports on the host machine to the internal container ports.
For example:
This would expose the frontend on the host's port 8080 and backend on port 3000.
To link them, the frontend would just need to make requests to host-ip:3000 to hit the backend API.
Now to use custom domains, you'd point the domains to the host IP, and route traffic to the mapped ports.
For example:
Route traffic from frontend.mydomain.com:80 to host port 8080
Map api.mydomain.com to host IP
Route traffic from api.mydomain.com:80 to host port 3000
This way your domains are abstracted from the internal Docker ports/IPs.
You can also use a reverse proxy like Nginx to handle routing requests from custom domains to your Docker containers.
Hope this helps explain how to handle networking and domains with Docker! Let me know if you have any other questions.
Excellent answer to my question really appreciate it.
How will you host your app?
Most server provider has docker as an option.
When hosting on your own vps, you'd install docker just like you'd do on your machine.
Which server host did you deploy your docker image to?
render
This is really cool, I have faced the same deployment issues since I first tried to deploy my express application. Are there recommended resources one can use to learn Docker? thanks.
yes, one from net ninja on youtube.