Created
November 3, 2023 13:59
-
-
Save harsh4870/5dfbc28b3358c90d33b73d32e028bcc1 to your computer and use it in GitHub Desktop.
Docker compose basic Ubuntu & Nginx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
version: "3" | |
services: | |
ubuntu: | |
container_name: ubuntu | |
image: ubuntu | |
restart: on-failure | |
command: ["sleep","infinity"] | |
ports: | |
- '6379:80' | |
nginx: | |
container_name: nginx | |
image: nginx | |
ports: | |
- '8080:80' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Save file with same name and run the below commands,
docker-compose up
Make sure file should exist in same dir where running command
Check container status
docker ps
If Ubuntu & Nginx container running
Go inside the Ubuntu Container
docker exec -it ubuntu bash
Now you are inside the container update the packages
apt update && apt install curl
Let's now try connecting to Nginx
curl nginx
You can install other module as per requirement on Ubuntu container (Consider it like PC) and from any other container you can connect to it by service name. .