# Cannot rebuild following site failure: "postgres already running"

**URL:** https://meta.discourse.org/t/cannot-rebuild-following-site-failure-postgres-already-running/24102
**Category:** Self-hosting
**Created:** [January 16, 2015, 10:06pm UTC](https://meta.discourse.org/t/cannot-rebuild-following-site-failure-postgres-already-running/24102 "2015-01-16T22:06:26Z")
**Posts on this page:** 16
**Page:** 1

<div class="post-metadata">

### Author: ![DaveShaw](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/daveshaw/32/114847_2.png) [@DaveShaw](https://meta.discourse.org/u/DaveShaw)
#### Post date: [January 16, 2015, 10:06pm UTC](https://meta.discourse.org/t/cannot-rebuild-following-site-failure-postgres-already-running/24102/1 "2015-01-16T22:06:27Z")

</div>

My discourse crashed, so I tried rebuilding and I am getting the following error message. I was on 1.2.0beta4 before it went down.

I’ve rebooted the VM twice and I am getting the same problem:

Any ideas?

The full output of a rebuild now is:

```plaintext
/var/discourse$ sudo ./launcher rebuild app
WARNING: No swap limit support
Updating discourse docker
Already up-to-date.
Stopping old container
Error response from daemon: No such container: 8fc10a0a1c682060ef7ef3ff06945abc1bc9cd7e88336299eb8975e652bd9890
2015/01/15 23:15:53 Error: failed to stop one or more containers
Calculated ENV: -e LANG=en_US.UTF-8 -e RAILS_ENV=production -e UNICORN_WORKERS=2 -e UNICORN_SIDEKIQS=1 -e RUBY_GC_MALLOC_LIMIT=40000000 -e RUBY_HEAP_MIN_SLOTS=800000 -e DISCOURSE_DB_SOCKET=/var/run/postgresql -e DISCOURSE_DB_HOST= -e DISCOURSE_DB_PORT= -e HOME=/root -e DISCOURSE_DEVELOPER_EMAILS=hidded@example.org -e DISCOURSE_HOSTNAME=tolguild.co.uk -e DISCOURSE_SMTP_ADDRESS=smtp.mandrillapp.com -e DISCOURSE_SMTP_PORT=587 -e DISCOURSE_SMTP_USER_NAME=hidden@example.org -e DISCOURSE_SMTP_PASSWORD=hidden
cd /pups && git pull && /pups/bin/pups --stdin
Already up-to-date.
I, [2015-01-15T23:15:59.292757 #42] INFO -- : Loading --stdin
I, [2015-01-15T23:15:59.305246 #42] INFO -- : > mkdir -p /shared/postgres_run
I, [2015-01-15T23:15:59.307805 #42] INFO -- :
I, [2015-01-15T23:15:59.312513 #42] INFO -- : > chown postgres:postgres /shared/postgres_run
I, [2015-01-15T23:15:59.314954 #42] INFO -- :
I, [2015-01-15T23:15:59.315604 #42] INFO -- : > chmod 775 /shared/postgres_run
I, [2015-01-15T23:15:59.317583 #42] INFO -- :
I, [2015-01-15T23:15:59.322184 #42] INFO -- : > rm -fr /var/run/postgresql
I, [2015-01-15T23:15:59.324303 #42] INFO -- :
I, [2015-01-15T23:15:59.325098 #42] INFO -- : > ln -s /shared/postgres_run /var/run/postgresql
I, [2015-01-15T23:15:59.326968 #42] INFO -- :
I, [2015-01-15T23:15:59.327703 #42] INFO -- : > socat /dev/null UNIX-CONNECT:/shared/postgres_run/.s.PGSQL.5432 || exit 0 && echo postgres already running stop container ; exit 1
I, [2015-01-15T23:15:59.336875 #42] INFO -- : postgres already running stop container

FAILED
--------------------
RuntimeError: socat /dev/null UNIX-CONNECT:/shared/postgres_run/.s.PGSQL.5432 || exit 0 && echo postgres already running stop container ; exit 1 failed with return #<Process::Status: pid 49 exit 1>
Location of failure: /pups/lib/pups/exec_command.rb:105:in `spawn'
exec failed with the params "socat /dev/null UNIX-CONNECT:/shared/postgres_run/.s.PGSQL.5432 || exit 0 && echo postgres already running stop container ; exit 1"
fe8f9c6922355ce819ce32e35b11f0f87cced5cb7ffaff6f115a2cfc9f0e4608
FAILED TO BOOTSTRAP

```

Cheers,  
Dave

---

<div class="post-metadata">

### Author: ![DaveShaw](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/daveshaw/32/114847_2.png) [@DaveShaw](https://meta.discourse.org/u/DaveShaw)
#### Post date: [January 17, 2015, 12:25am UTC](https://meta.discourse.org/t/cannot-rebuild-following-site-failure-postgres-already-running/24102/2 "2015-01-17T00:25:18Z")

</div>

As per [another topic](https://meta.discourse.org/t/error-while-bootstrapping-launcher/20213/5), `docker ps` shows the following:

```
/$ docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
570f65df6a38 local_discourse/app:latest "/sbin/runit" 3 months ago Up 25 hours 0.0.0.0:80->80/tcp, 0.0.0.0:443->443/tcp, 0.0.0.0:2222->22/tcp determined_pike
```

So I ran `docker kill 570f65df6a38`.

It now appears to be rebuilding…

---

<div class="post-metadata">

### Author: ![codinghorror](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/codinghorror/32/110067_2.png) [@codinghorror](https://meta.discourse.org/u/codinghorror)
#### Post date: [January 17, 2015, 12:48am UTC](https://meta.discourse.org/t/cannot-rebuild-following-site-failure-postgres-already-running/24102/3 "2015-01-17T00:48:49Z")

</div>

Yes, the relevant line is

```
2015/01/15 23:15:53 Error: failed to stop one or more containers

```

It looks like Docker was having trouble stopping your container.

Definitely update Docker to latest if it is not already at latest.

---

<div class="post-metadata">

### Author: ![DaveShaw](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/daveshaw/32/114847_2.png) [@DaveShaw](https://meta.discourse.org/u/DaveShaw)
#### Post date: [January 18, 2015, 4:40pm UTC](https://meta.discourse.org/t/cannot-rebuild-following-site-failure-postgres-already-running/24102/4 "2015-01-18T16:40:31Z")

</div>

Thanks Jeff.

After killing the docker process, the rebuild still failed, so I ran the following:

```
sudo apt-get update && sudo apt-get dist-upgrade

```

From this thread [here](http://askubuntu.com/questions/56348/how-do-i-update-ubuntu), and this time the rebuild failed.

Thanks again for your help, this Linux / Docker / Ruby / Postgres setup is well out of my comfort zone, but your guys are really helpful, so I keep struggling on and learning all the way 😄.

---

<div class="post-metadata">

### Author: ![codinghorror](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/codinghorror/32/110067_2.png) [@codinghorror](https://meta.discourse.org/u/codinghorror)
#### Post date: [January 18, 2015, 8:44pm UTC](https://meta.discourse.org/t/cannot-rebuild-following-site-failure-postgres-already-running/24102/5 "2015-01-18T20:44:19Z")

</div>

No, you need to update Docker itself. There is another command to force Docker to update to latest. I believe it is apt-get lxc-docker or similar. There is at least one howto here on updating Docker.

---

<div class="post-metadata">

### Author: ![DaveShaw](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/daveshaw/32/114847_2.png) [@DaveShaw](https://meta.discourse.org/u/DaveShaw)
#### Post date: [January 18, 2015, 10:34pm UTC](https://meta.discourse.org/t/cannot-rebuild-following-site-failure-postgres-already-running/24102/6 "2015-01-18T22:34:01Z")

</div>

Ah, I didn’t know 😊.

`git pull` says everything is up to date, so I guess whatever I’ve done has updated everything.

---

<div class="post-metadata">

### Author: ![codinghorror](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/codinghorror/32/110067_2.png) [@codinghorror](https://meta.discourse.org/u/codinghorror)
#### Post date: [January 19, 2015, 1:34am UTC](https://meta.discourse.org/t/cannot-rebuild-following-site-failure-postgres-already-running/24102/7 "2015-01-19T01:34:16Z")

</div>

What does `docker --version` say? Should be 1.4.1 or later I believe.

---

<div class="post-metadata">

### Author: ![DaveShaw](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/daveshaw/32/114847_2.png) [@DaveShaw](https://meta.discourse.org/u/DaveShaw)
#### Post date: [January 19, 2015, 9:33pm UTC](https://meta.discourse.org/t/cannot-rebuild-following-site-failure-postgres-already-running/24102/8 "2015-01-19T21:33:42Z")

</div>

Mine reports:

```
Docker version 1.2.0, build fa7b24f

```

I used this [post](https://meta.discourse.org/t/how-do-i-update-my-docker-image-to-latest/23325) by Sam for the “how to update”.

I’ve found a few threads ([here](http://askubuntu.com/questions/472412/how-do-i-upgrade-docker) and [here](https://docs.docker.com/installation/ubuntulinux/)) on the net, but if you could provide the best approach it would be appreciated.

---

<div class="post-metadata">

### Author: ![codinghorror](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/codinghorror/32/110067_2.png) [@codinghorror](https://meta.discourse.org/u/codinghorror)
#### Post date: [January 19, 2015, 9:34pm UTC](https://meta.discourse.org/t/cannot-rebuild-following-site-failure-postgres-already-running/24102/9 "2015-01-19T21:34:47Z")

</div>

As mentioned in a number of topics here

```
apt-get update
apt-get dist-upgrade lxc-docker

```

Your Docker is out of date.

Then rebuild.

---

<div class="post-metadata">

### Author: ![DaveShaw](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/daveshaw/32/114847_2.png) [@DaveShaw](https://meta.discourse.org/u/DaveShaw)
#### Post date: [January 19, 2015, 10:41pm UTC](https://meta.discourse.org/t/cannot-rebuild-following-site-failure-postgres-already-running/24102/10 "2015-01-19T22:41:13Z")

</div>

OK that’s done it:

```
Docker version 1.4.1, build 5bc2ff8

```

Cheers Jeff.

I guess I need to keep more up to date that I have been.

---

<div class="post-metadata">

### Author: ![oblio](https://avatars.discourse-cdn.com/v4/letter/o/c4cdca/32.png) [@oblio](https://meta.discourse.org/u/oblio)
#### Post date: [September 16, 2015, 1:22pm UTC](https://meta.discourse.org/t/cannot-rebuild-following-site-failure-postgres-already-running/24102/11 "2015-09-16T13:22:10Z")

</div>

I’m hitting this with Docker 1.7.1 and the latest version of Discourse. I want to rebuild because I get this in the performance reports thread:

> Report is only available in latest image, please run:  
> cd /var/discourse  
> ./launcher rebuild app

The error is:

```plaintext

I, [2015-09-16T13:19:11.708621 #39] INFO -- : > socat /dev/null UNIX-CONNECT:/shared/postgres_run/.s.PGSQL.5432 || exit 0 && echo postgres already running stop container ; exit 1
I, [2015-09-16T13:19:11.721860 #39] INFO -- : postgres already running stop container

FAILED
--------------------
RuntimeError: socat /dev/null UNIX-CONNECT:/shared/postgres_run/.s.PGSQL.5432 || exit 0 && echo postgres already running stop container ; exit 1 failed with return #<Process::Status: pid 46 exit 1>
Location of failure: /pups/lib/pups/exec_command.rb:105:in `spawn'
exec failed with the params "socat /dev/null UNIX-CONNECT:/shared/postgres_run/.s.PGSQL.5432 || exit 0 && echo postgres already running stop container ; exit 1"
323124ae8ceb4b35d3e926876f605fa71d5e5fe308a1ab18b9d1f8072b3fff6b
**FAILED TO BOOTSTRAP** please scroll up and look for earlier error messages, there may be more than one

```

The forum itself is working but I’d like to have the performance reports as well…

---

<div class="post-metadata">

### Author: ![sam](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/sam/32/102149_2.png) [@sam](https://meta.discourse.org/u/sam)
#### Post date: [September 16, 2015, 8:26pm UTC](https://meta.discourse.org/t/cannot-rebuild-following-site-failure-postgres-already-running/24102/12 "2015-09-16T20:26:01Z")

</div>

> [@oblio](#):
>
> postgres already running stop container

What does

```plaintext
docker ps

```

return?

---

<div class="post-metadata">

### Author: ![oblio](https://avatars.discourse-cdn.com/v4/letter/o/c4cdca/32.png) [@oblio](https://meta.discourse.org/u/oblio)
#### Post date: [September 17, 2015, 11:47am UTC](https://meta.discourse.org/t/cannot-rebuild-following-site-failure-postgres-already-running/24102/13 "2015-09-17T11:47:42Z")

</div>

```plaintext
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
c05bf6a1b8fa local_discourse/app "/sbin/boot" 5 weeks ago Up 22 hours 0.0.0.0:443->443/tcp, 0.0.0.0:2222->22/tcp app

```

---

<div class="post-metadata">

### Author: ![sam](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/sam/32/102149_2.png) [@sam](https://meta.discourse.org/u/sam)
#### Post date: [September 17, 2015, 12:02pm UTC](https://meta.discourse.org/t/cannot-rebuild-following-site-failure-postgres-already-running/24102/14 "2015-09-17T12:02:50Z")

</div>

Stop that container and then rebuild

---

<div class="post-metadata">

### Author: ![oblio](https://avatars.discourse-cdn.com/v4/letter/o/c4cdca/32.png) [@oblio](https://meta.discourse.org/u/oblio)
#### Post date: [September 17, 2015, 12:26pm UTC](https://meta.discourse.org/t/cannot-rebuild-following-site-failure-postgres-already-running/24102/15 "2015-09-17T12:26:41Z")

</div>

I found the root case. I had renamed the container “standalone” but apparently something went wrong and even though Discourse worked, some bits and pieces were still looking for “app”.

After a docker restart and OS restart the forum was running, as “app”, even though the container was “standalone.yml”.

I have no idea how this could have happened, isn’t the container name just the yml file name?

Can I force the execution of the performance report or do I have to wait for cron to trigger it?

---

<div class="post-metadata">

### Author: ![JammyDodger](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/jammydodger/32/254611_2.png) [@JammyDodger](https://meta.discourse.org/u/JammyDodger)
#### Post date: [June 8, 2024, 12:46pm UTC](https://meta.discourse.org/t/cannot-rebuild-following-site-failure-postgres-already-running/24102/16 "2024-06-08T12:46:01Z")

</div>

This topic was automatically closed after 3430 days. New replies are no longer allowed.
