Skip to content

Commit 77c6920

Browse files
author
Anca Iordache
committed
Fix default port mapping and indentation
Signed-off-by: Anca Iordache <[email protected]>
1 parent dc1bb13 commit 77c6920

File tree

20 files changed

+111
-108
lines changed

20 files changed

+111
-108
lines changed

angular/README.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,14 +19,14 @@ services:
1919
web:
2020
build: angular
2121
ports:
22-
- 80:4200
22+
- 4200:4200
2323
...
2424
2525
```
2626
The compose file defines an application with one service `angular`. The image for the service is built with the Dockerfile inside the `angular` directory (build parameter).
2727

28-
When deploying the application, docker-compose maps the container port 4200 to port 80 of the host as specified in the file.
29-
Make sure port 80 is not being used by another container, otherwise the port should be changed.
28+
When deploying the application, docker-compose maps the container port 4200 to the same port on the host as specified in the file.
29+
Make sure port 4200 is not being used by another container, otherwise the port should be changed.
3030

3131

3232
## Deploy with docker-compose
@@ -53,11 +53,11 @@ Listing containers must show a container running and the port mapping as below:
5353
```
5454
$ docker ps
5555
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
56-
6884c228388e angular_web "docker-entrypoint.s…" 42 seconds ago Up 36 seconds 0.0.0.0:80->4200/tcp angular_web_1
56+
6884c228388e angular_web "docker-entrypoint.s…" 42 seconds ago Up 36 seconds 0.0.0.0:4200->4200/tcp angular_web_1
5757
5858
```
5959

60-
After the application starts, navigate to `http://localhost:80` in your web browser.
60+
After the application starts, navigate to `http://localhost:4200` in your web browser.
6161

6262
![page](output.jpg)
6363

angular/docker-compose.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ services:
33
web:
44
build: angular
55
ports:
6-
- 80:4200
6+
- 4200:4200
77
volumes:
8-
- ./angular:/project
9-
- /project/node_modules
8+
- ./angular:/project
9+
- /project/node_modules

aspnet-mssql/docker-compose.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ services:
33
web:
44
build: app
55
ports:
6-
- 80:80
6+
- 80:80
77
db:
88
environment:
99
ACCEPT_EULA: "Y"

gitea-postgres/README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ services:
1515
gitea:
1616
image: gitea/gitea:latest
1717
ports:
18-
- 80:3000
18+
- 3000:3000
1919
...
2020
db:
2121
image: postgres:alpine
@@ -24,7 +24,7 @@ services:
2424
```
2525

2626
When deploying this setup, docker-compose maps the nextcloud container port 3000 to
27-
port 80 of the host as specified in the compose file.
27+
the same port of the host as specified in the compose file.
2828

2929
## Deploy with docker-compose
3030

@@ -46,11 +46,11 @@ Check containers are running and the port mapping:
4646
```
4747
$ docker ps
4848
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
49-
2f5624043da9 gitea/gitea:latest "/usr/bin/entrypoint…" 56 seconds ago Up 16 seconds 22/tcp, 0.0.0.0:80->3000/tcp gitea-postgres_gitea_1
49+
2f5624043da9 gitea/gitea:latest "/usr/bin/entrypoint…" 56 seconds ago Up 16 seconds 22/tcp, 0.0.0.0:3000->3000/tcp gitea-postgres_gitea_1
5050
86acc768453e postgres:alpine "docker-entrypoint.s…" 57 seconds ago Up 17 seconds 5432/tcp gitea-postgres_db_1
5151
```
5252

53-
Navigate to `http://localhost:80` in your web browser to access the installed
53+
Navigate to `http://localhost:3000` in your web browser to access the installed
5454
Gitea service.
5555

5656
![page](output.jpg)

gitea-postgres/docker-compose.yaml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,7 @@ services:
1212
volumes:
1313
- git_data:/data
1414
ports:
15-
- 80:3000
16-
depends_on:
17-
- db
15+
- 3000:3000
1816
db:
1917
image: postgres:alpine
2018
environment:

nginx-flask-mongo/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,8 @@ Creating nginx-flask-mongo_web_1 ... done
5353
Listing containers must show two containers running and the port mapping as below:
5454
```
5555
$ docker ps
56-
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
57-
a0f4ebe686ff nginx "/bin/bash -c 'envsu…" About a minute ago Up About a minute 0.0.0.0:8080->80/tcp nginx-flask-mongo_web_1
56+
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
57+
a0f4ebe686ff nginx "/bin/bash -c 'envsu…" About a minute ago Up About a minute 0.0.0.0:80->80/tcp nginx-flask-mongo_web_1
5858
dba87a080821 nginx-flask-mongo_backend "./server.py" About a minute ago Up About a minute nginx-flask-mongo_backend_1
5959
d7eea5481c77 mongo "docker-entrypoint.s…" About a minute ago Up About a minute 27017/tcp nginx-flask-mongo_mongo_1
6060
```

nginx-flask-mongo/docker-compose.yaml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,15 @@ services:
88
- FLASK_SERVER_ADDR=backend:9091
99
command: /bin/bash -c "envsubst < /tmp/nginx.conf > /etc/nginx/conf.d/default.conf && nginx -g 'daemon off;'"
1010
ports:
11-
- 8080:80
11+
- 80:80
1212
depends_on:
13-
- backend
13+
- backend
1414
backend:
1515
build: flask
1616
environment:
17-
- FLASK_SERVER_PORT=9091
17+
- FLASK_SERVER_PORT=9091
1818
volumes:
19-
- ./flask:/src
19+
- ./flask:/src
2020
depends_on:
2121
- mongo
2222
mongo:

nginx-flask-mysql/docker-compose.yaml

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@ services:
55
command: '--default-authentication-plugin=mysql_native_password'
66
restart: always
77
secrets:
8-
- db-password
8+
- db-password
99
volumes:
10-
- db-data:/var/lib/mysql
10+
- db-data:/var/lib/mysql
1111
networks:
1212
- backnet
1313
environment:
@@ -17,17 +17,17 @@ services:
1717
build: backend
1818
restart: always
1919
secrets:
20-
- db-password
20+
- db-password
2121
ports:
22-
- 5000:5000
22+
- 5000:5000
2323
networks:
24-
- backnet
25-
- frontnet
24+
- backnet
25+
- frontnet
2626
proxy:
2727
build: proxy
2828
restart: always
2929
ports:
30-
- 80:80
30+
- 80:80
3131
networks:
3232
- frontnet
3333
volumes:

nginx-golang-mysql/docker-compose.yaml

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3,27 +3,28 @@ services:
33
backend:
44
build: backend
55
secrets:
6-
- db-password
6+
- db-password
77
depends_on:
8-
- db
8+
- db
99
db:
10-
environment:
11-
MYSQL_DATABASE: example
12-
MYSQL_ROOT_PASSWORD_FILE: /run/secrets/db-password
13-
image: mysql:5.7
10+
image: mysql:8.0.19
11+
command: '--default-authentication-plugin=mysql_native_password'
1412
restart: always
1513
secrets:
16-
- db-password
14+
- db-password
1715
volumes:
18-
- db-data:/var/lib/mysql
16+
- db-data:/var/lib/mysql
17+
environment:
18+
- MYSQL_DATABASE=example
19+
- MYSQL_ROOT_PASSWORD_FILE=/run/secrets/db-password
1920
proxy:
2021
build: proxy
2122
ports:
22-
- 80:80
23+
- 80:80
2324
depends_on:
24-
- backend
25+
- backend
2526
volumes:
26-
db-data: {}
27+
db-data:
2728
secrets:
2829
db-password:
2930
file: db/password.txt

nginx-golang-postgres/docker-compose.yaml

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,27 +3,28 @@ services:
33
backend:
44
build: backend
55
secrets:
6-
- db-password
6+
- db-password
77
depends_on:
8-
- db
8+
- db
99
db:
10-
environment:
11-
POSTGRES_DB: example
12-
POSTGRES_PASSWORD_FILE: /run/secrets/db-password
1310
image: postgres
1411
restart: always
1512
secrets:
16-
- db-password
13+
- db-password
1714
volumes:
18-
- db-data:/var/lib/postgresql/data
15+
- db-data:/var/lib/postgresql/data
16+
environment:
17+
- POSTGRES_DB=example
18+
- POSTGRES_PASSWORD_FILE=/run/secrets/db-password
19+
1920
proxy:
2021
build: proxy
2122
ports:
22-
- 80:80
23+
- 80:80
2324
depends_on:
24-
- backend
25+
- backend
2526
volumes:
26-
db-data: {}
27+
db-data:
2728
secrets:
2829
db-password:
2930
file: db/password.txt

0 commit comments

Comments
 (0)