Docker To Reproduce Prod
February 28, 2024 · 1 min readLucian CiobanuI recently came across an interesting situation - having a wizard with some automatically created components, I thought I could use the components names as a indicator when to activate and inactivate various. However, after the angular build, all these names had been obfuscated leaving my conditions useless. I found my self in a tough predicament as the app was working on my machine but not on a different environment.
In order to fully replicate the situation, I decided to use docker for the first time and this is how I did it:
1. navigated to the project directory from the command line and docker-compose --version
2. project directory from the command line and
docker-compose build
3. type the command
docker network create sandbox
4. I went to my mac's host files and added to 127.0.0.1 the link on which my app is accessible with nano editor
sudo nano /etc/hosts
5. on the last line in the file, I've included
127.0.0.1 www.app-access.com
In nano editor, you can use CTRL + O to overwrite the existing file followed by enter/return key and exit by CTRL + X. The added link is what I got from the dev ops team.
6. type the command below to enable the local docker
docker-compose up
After each change made to the code, docker-compose down (or ctrl + C), docker-compose build and docker-compose up are necessary to refresh the app.
Hope this helped!
Cheers,
Lucian

Web Development & Software Delivery