Docker Community Forums

Share and learn in the Docker community.

Postgres container already running + computer restart = container appears, is not usable and cannot be restarted (error)

(Vinz33000) #1


For information, I use “windows 10 Powershell” and the last docker software.

The procedure which creates the error is below:

Firslty, i create a container from the last postgres image thanks to the following commands :

docker pull postgres
docker run --name postgresbdd -e POSTGRES_PASSWORD=postgres -p 5432:5432 -d postgres

After this operation, i get a correct postgres container and it works fine with my java application.
i can open a psql container too thanks to the command :

docker run -it --rm --link postgresbdd:postgres postgres psql -h postgres -U postgres

Nevertheless, when i restart my computer, there is a problem which appears.
With the command below, the process is always launched :

docker ps

However, when i start my java application, the access is not possible.
If i try to stop and start or restart the container there is the following error:

Error response from daemon: driver failed programming external connectivity on endpoint postgresbdd (d79f1908f7e42544992 8b4ca0136cf1cf807dc843bd175c6e793bc4385dddf5d): Error starting userland proxy: mkdir /port/tcp: .2:5432: input/output error Error: failed to start containers: 3be39913

After this error, i tried to do the following operations :

  1. if i immediatly watch the ports which are used thanks to the netstat -anob or netstat -a -b commands, the 5432 port is not in the returned data.
  2. If i launch the tasklist /v > "tasks.txt" command, the 5432 port is not visible in the tasks.txt file which is created.
  3. If i delete the container and create another one with -p 5433:5432, i always have the problem.

Now, I am totally lost and i don’t know how i could solve the problem.
Please, could you give me some advice and help (or the solution too :slight_smile: )


PS: I’m sorry if it’s not well written but I do not speak English very well.

(Sam) #2

when you start a container, it will persist forever, until you delete it.
UNLESS you specify --rm as one of the docker run parameters…

note, using --rm will cause ANY DATA in the container to be lost as the container will be discarded.

second, by default containers running prior to reboot will be restarted

but, the database was not shutdown cleanly and may need special handling to accomplish that
so I would look at the postgres database recovery information… the image you used may also provide some info. so I would look at the info on dockerhub for that image

third… the ip address of the restarted container may NOT be the same as before the reboot.

(Vinz33000) #3

Hello. Thanks you for your response. For information, I put the rm in order to create a connection to the database which is in the first container. The second container is temporary. In fact, a container is created each time i want to use psql.