I am starting following a course on Udemy. This couse uses Docker and I am finding the following problem. I am using Ubuntu 20.04 as operating system.
I have this docker-compose.yml file (provided as course resource):
version: '3.3'
networks:
ntpgsql:
driver: bridge
ipam:
driver: default
config:
- subnet: 172.21.0.0/24
services:
pgsql:
image: postgres:latest
restart: unless-stopped
container_name: postgresql
volumes:
- psdb-volume:/var/lib/postgresql/data
networks:
ntpgsql:
ipv4_address: 172.21.0.2
ports:
- target: 5432
published: 5433
protocol: tcp
mode: host
environment:
- POSTGRES_PASSWORD=123_Stella
pgadmin:
image: dpage/pgadmin4
restart: unless-stopped
container_name: pgadmin4
networks:
ntpgsql:
ipv4_address: 172.21.0.3
ports:
- target: 80
published: 80
protocol: tcp
mode: host
environment:
- PGADMIN_CONFIG_SERVER_MODE=True
- PGADMIN_DEFAULT_EMAIL=may-email@gmail.com
- PGADMIN_DEFAULT_PASSWORD=123_Stella
volumes:
psdb-volume:
So I accessed to the directory containing this configuration file and from my shell I performed this command to download and start rthese two containers defined into my configuration file:
docker-compose up
Images seems to be correctly downloaded but, at the end, I obtain this error message when it try to start the containers:
Status: Downloaded newer image for dpage/pgadmin4:latest
Creating pgadmin4 ...
Creating pgadmin4 ... error
WARNING: Host is already in use by another container
ERROR: for pgadmin4 Cannot start service pgadmin: driver failed programming external connectivity on endpoint pgadmin4 (a1643d333555ed47a666d5df57ab5db20a1f5e0a141fe6026f135689b1b7541d): Error starting userland proxy: listen tcp4 0.0.0.0:8Creating postgresql ... done
ERROR: for pgadmin Cannot start service pgadmin: driver failed programming external connectivity on endpoint pgadmin4 (a1643d333555ed47a666d5df57ab5db20a1f5e0a141fe6026f135689b1b7541d): Error starting userland proxy: listen tcp4 0.0.0.0:80: bind: address already in use
ERROR: Encountered errors while bringing up the project.
andrea@ubuntu:~/Documents/spirng-microservies-course$ docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
8467ee204a9d postgres:latest "docker-entrypoint.sā¦" About a minute ago Up About a minute 0.0.0.0:5433->5432/tcp, :::5433->5432/tcp postgresql
It seems to me that it have correctly started the first container listed in my configuration file (the one named postgresql) but not the second one (named pgadmin4).
What could be the problem? How can I try to fix it?