Public bug reported:

I used this Dockerfile to reproduce this problem:

```
FROM ubuntu:16.04
RUN apt-get update && apt-get install -y postgresql sudo
RUN service postgresql start && \
    sudo -u postgres psql -c "CREATE DATABASE test1;"
RUN service postgresql start && \
    sudo -u postgres psql -c "CREATE DATABASE test2;"

```
When second `service postgresql start` performed I got and error:
```
psql: FATAL:  the database system is starting up
The command '/bin/sh -c service postgresql start &&     sudo -u postgres psql 
-c "CREATE DATABASE test;"' returned a non-zero code: 2
```

But if I add some timeout after start command everything is fine
```
FROM ubuntu:16.04
RUN apt-get update && apt-get install -y postgresql sudo
RUN service postgresql start && \
    sudo -u postgres psql -c "CREATE DATABASE test1;"
RUN service postgresql start && \
    sleep 30 && \
    sudo -u postgres psql -c "CREATE DATABASE test2;"
```

Versions are:
dpkg -l | grep postgre
ii  postgresql                 9.5+173ubuntu0.2                      all        
  object-relational SQL database (supported version)
ii  postgresql-9.5             9.5.16-0ubuntu0.16.04.1               amd64      
  object-relational SQL database, version 9.5 server
ii  postgresql-client-9.5      9.5.16-0ubuntu0.16.04.1               amd64      
  front-end programs for PostgreSQL 9.5
ii  postgresql-client-common   173ubuntu0.2                          all        
  manager for multiple PostgreSQL client versions
ii  postgresql-common          173ubuntu0.2                          all        
  PostgreSQL database-cluster manager
ii  postgresql-contrib-9.5     9.5.16-0ubuntu0.16.04.1               amd64      
  additional facilities for PostgreSQL

** Affects: postgresql-9.5 (Ubuntu)
     Importance: Undecided
         Status: New

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/1826847

Title:
  `service postgresql start` exit before actual starts happened

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/postgresql-9.5/+bug/1826847/+subscriptions

-- 
ubuntu-bugs mailing list
[email protected]
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to