I want to run two different docker containers with different domain names on a ubuntu…
- User
I want to run two different docker containers with different domain names on a ubuntu server.
every container has two images named frontend and backend.
every container has a git repo that will be pulled to a folder /home/deployer/sites/docker.
every image in the container run on the same domain: for example frontend runs on the domain root (www.domain1.com) and backend runs on a subfolder (www.domain1.com/admin)
the second app contailer: frontend runs on the domain root (www.domain2.com) and backend runs on a subfolder (www.domain2.com/admin)
maybe having nginx also in a docker container.
can you please give me a step by step instruction?
- Assistant
- User
what is the next step? how do I run them after I did all that
- Assistant
Once you have created the Docker Compose files and the nginx-proxy network, you can run the containers using the following steps:
- Navigate to the directory where you created the Docker Compose files:
bashcd /home/deployer/sites/docker- Run the Docker Compose files for each app, using the following commands:
codedocker-compose -f docker-compose-app1.yml up -dcodedocker-compose -f docker-compose-app2.yml up -dThese commands will start the containers in detached mode (
-doption), which means they will run in the background. 3. Verify that the containers are running using the following command:codedocker psThis command should list all the running containers on your server. 4. If you haven't already, you need to configure your DNS records to point to your server's IP address for the two domain names, and . 5. Once you have updated the DNS records, you should be able to access the two apps using the domain names and subdomains you specified in the Docker Compose files. For example, you can access the frontend of the first app at and the backend at . Similarly, you can access the frontend of the second app at and the backend at .