# Manually update Discourse and Docker image to latest

**URL:** https://meta.discourse.org/t/manually-update-discourse-and-docker-image-to-latest/23325
**Category:** Self-Hosting
**Tags:** how-to
**Created:** [December 21, 2014, 11:47pm UTC](https://meta.discourse.org/t/manually-update-discourse-and-docker-image-to-latest/23325 "2014-12-21T23:47:15Z")
**Posts on this page:** 16
**Page:** 1

<div class="post-metadata">

### Author: ![Discourse](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/discourse/32/148734_2.png) [@Discourse](https://meta.discourse.org/u/Discourse)
#### Post date: [December 21, 2014, 11:47pm UTC](https://meta.discourse.org/t/manually-update-discourse-and-docker-image-to-latest/23325/1 "2014-12-21T23:47:15Z")

</div>

> 🔖 This guide provides step-by-step instructions for manually updating Discourse, the Docker container, and the Ubuntu operating system on a self-hosted setup.
> 
> 🙋 Required user level: System Administrator
> 
> ⚠ SSH access to the server.

If you self-host Discourse, you occasionally need to run a manual update via the command line to get the latest security releases and newest libraries.

These updates are **not** picked up in `admin/upgrade`, which is why you’ll occasionally need to do these additional steps:

## Updating Discourse

1. Discourse itself should be updated about twice a month, by clicking the “Update to Latest Version” button in your admin dashboard (`admin/upgrade`).

2. Every two months we recommend SSH’ing into your web server (using putty or your favorite SSH client) and running the following commands, especially if the upgrade page doesn’t show up or you have any issues when trying to upgrade.

```bash
cd /var/discourse
./launcher rebuild app

```

## Updating the Docker image and Ubuntu OS

For Ubuntu updates, make _sure_ you have automatic security updates enabled for your Ubuntu! The command is:

```bash
dpkg-reconfigure -plow unattended-upgrades

```

However, that just covers **critical security** updates. Every so often you should get all the OS updates like so:

```bash
apt-get update
apt-get dist-upgrade

```

This will also keep Docker up to date via the standard `docker-ce` packages.

To summarize:

- update Discourse twice a month via web updater
- update the container every two months
- update the OS every six months

**You could double these numbers and still be fairly safe** , e.g. update Discourse once a month, container every 4 months, OS once every 12 months, and so on.

But you really, _really_ want automatic security updates enabled in Ubuntu, as listed above.

## FAQ

### What is the right time to update?

It just depends on the time you have available and how close to bleeding edge you want to be. If you have non-official plugins, it is highly advisable to utilize a test/staging site. If you do not have any non-official plugins, you can likely upgrade immediately, but even then, some plugins may break for a couple of days as the team fixes them (there are a lot of them).

### What is common practice when updating with many plugins installed?

If you have a lot of plugins, testing locally or on a test server is highly advised. Especially if you have non-official plugins, as something could have broken. If you find something does break, then it is a matter of, do you have time to fix it? Does the original plugin author have time to fix it? Either of those could take weeks. So at least this way, you simply have a broken test site and not a broken production site.

### I’m running low on disk space

If you are running low on disk space (check with `df`) try clearing up old images using:

```plaintext
./launcher cleanup
apt-get autoclean
apt-get autoremove

```

### Does updating the actual server version of Ubuntu matter since Discourse always operates in Docker?

It matters a lot less. But you should be on at least a [currently supported LTS release of Ubuntu server](https://www.ubuntu.com/info/release-end-of-life). A 64-bit Linux OS with a modern kernel version is required.

 ![grafik](https://global.discourse-cdn.com/meta/original/3X/4/e/4e8d8f21311584ea2744416ef939a1f9a297c2f0.png)

> Last edited by @SaraDev 2024-11-21T21:25:01Z
> 
> > **Check document**
> >
> > Perform check on document:

---

<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 6, 2022, 2:59pm UTC](https://meta.discourse.org/t/manually-update-discourse-and-docker-image-to-latest/23325/260 "2022-06-06T14:59:59Z")

</div>

The guides are reviewed and updated fairly frequently (this one looks like it had a little tweak in February). 👍

The only one in there that I’m not personally familiar with is the docker one:

> [@sam](#):
>
> Due to the way docker packaging has changed you may also have to update your docker from lxc-docker or docker-engine packages. One way to do that is via the Docker script here (it will warn about an existing install but should upgrade ok):
> 
> ```plaintext
> wget -qO- https://get.docker.com/ | sh
> 
> ```
> 
> This will now use the docker-ce main versions.
> 
> This is completely safe, we have never seen anything get broken by base Ubuntu updates.

But I can vouch for the accuracy of the rest. 🙂

---

<div class="post-metadata">

### Author: ![MarkDoerr](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/markdoerr/32/549630_2.png) [@MarkDoerr](https://meta.discourse.org/u/MarkDoerr)
#### Post date: [June 6, 2022, 11:30pm UTC](https://meta.discourse.org/t/manually-update-discourse-and-docker-image-to-latest/23325/261 "2022-06-06T23:30:30Z")

</div>

I just ran through the entirety of these commands on my test site, including the docker update, and they worked without any problems.

---

<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: [February 4, 2024, 7:17am UTC](https://meta.discourse.org/t/manually-update-discourse-and-docker-image-to-latest/23325/279 "2024-02-04T07:17:25Z")

</div>

> [@sam](#):
>
> Due to the way docker packaging has changed you may also have to update your docker from lxc-docker or docker-engine packages. One way to do that is via the Docker script here (it will warn about an existing install but should upgrade ok):
> 
> ```plaintext
> wget -qO- https://get.docker.com/ | sh
> 
> ```
> 
> This will now use the docker-ce main versions.

I’ve had a report of this causing an issue when run. I don’t think I’ve ever used it myself in the couple of years of having a DO test site.

Does anyone have any recent experience of it to say whether it’s still relevant advice or not?

* * *

I’ve just had a browse of the deleted posts and I found a couple where that part of the guide was raised before \[1\] and it seems @MarkDoerr ran it with no issues.

Though I’m still unsure if when/under what circumstances you’d be required to run it? Do I have too much faith in [Docker Manager](https://meta.discourse.org/t/discourse-docker-manager/12655)?

* * *

1. I’ve undeleted them

---

<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 2, 2024, 12:06pm UTC](https://meta.discourse.org/t/manually-update-discourse-and-docker-image-to-latest/23325/291 "2024-06-02T12:06:39Z")

</div>

2 posts were split to a new topic: [When to update the data container of a two container setup?](https://meta.discourse.org/t/when-to-update-the-data-container-of-a-two-container-setup/310242)

---

<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 2, 2024, 12:02pm UTC](https://meta.discourse.org/t/manually-update-discourse-and-docker-image-to-latest/23325/295 "2024-06-02T12:02:05Z")

</div>

A post was split to a new topic: [Upgrading v2.2.0.beta4 forum with unknown local changes](https://meta.discourse.org/t/upgrading-v2-2-0-beta4-forum-with-unknown-local-changes/310241)

---

<div class="post-metadata">

### Author: ![Architect](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/architect/32/520575_2.png) [@Architect](https://meta.discourse.org/u/Architect)
#### Post date: [June 10, 2024, 8:28pm UTC](https://meta.discourse.org/t/manually-update-discourse-and-docker-image-to-latest/23325/296 "2024-06-10T20:28:16Z")

</div>

Have tried running that command (wget -qO- [https://get.docker.com/](https://get.docker.com/) | sh) now and reports:

`Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?`

Seems like this has not worked to update docker.

Also seems to have caused entire site to crash, and cannot rebuild app reports:

`Cannot connect to the docker daemon - verify it is running and you have access`

After rebooting server site is back online.

---

<div class="post-metadata">

### Author: ![pfaffman](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/pfaffman/32/120154_2.png) [@pfaffman](https://meta.discourse.org/u/pfaffman)
#### Post date: [June 10, 2024, 8:44pm UTC](https://meta.discourse.org/t/manually-update-discourse-and-docker-image-to-latest/23325/297 "2024-06-10T20:44:56Z")

</div>

> [@Architect](#):
>
> After rebooting server site is back online.

So maybe it did do the upgrade but failed to restart docker. You can check with

```
docker --version

```

It turns out my laptop had an old docker and I ran the recommended commmand and did not have to reboot for it to work. Here’s what I get for the version:

```plaintext
$ docker --version
Docker version 26.1.4, build 5650f9b

```

---

<div class="post-metadata">

### Author: ![Architect](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/architect/32/520575_2.png) [@Architect](https://meta.discourse.org/u/Architect)
#### Post date: [June 10, 2024, 8:50pm UTC](https://meta.discourse.org/t/manually-update-discourse-and-docker-image-to-latest/23325/298 "2024-06-10T20:50:38Z")

</div>

Have same docker version:

```plaintext
Docker version 26.1.4, build 5650f9b

```

---

<div class="post-metadata">

### Author: ![pfaffman](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/pfaffman/32/120154_2.png) [@pfaffman](https://meta.discourse.org/u/pfaffman)
#### Post date: [June 11, 2024, 2:56pm UTC](https://meta.discourse.org/t/manually-update-discourse-and-docker-image-to-latest/23325/299 "2024-06-11T14:56:05Z")

</div>

Then you’re up to date and all is well!

---

<div class="post-metadata">

### Author: ![ToddZ](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/toddz/32/328350_2.png) [@ToddZ](https://meta.discourse.org/u/ToddZ)
#### Post date: [August 25, 2024, 10:49pm UTC](https://meta.discourse.org/t/manually-update-discourse-and-docker-image-to-latest/23325/300 "2024-08-25T22:49:31Z")

</div>

I knew I’d seen this doc covering the Discourse update cadence, but had trouble finding it again because it’s in #Documentation under “Using Docker” and titled “Manually update Docker.”

Since it covers Discourse and Ubuntu updates, could it also have another place or two on the menu?

---

<div class="post-metadata">

### Author: ![tvavrda](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/tvavrda/32/480674_2.png) [@tvavrda](https://meta.discourse.org/u/tvavrda)
#### Post date: [January 15, 2025, 7:58am UTC](https://meta.discourse.org/t/manually-update-discourse-and-docker-image-to-latest/23325/301 "2025-01-15T07:58:39Z")

</div>

When Discourse advices you to update an image (so it is not possible to upgrade from the UI) it tells you to do this:

```plaintext
    cd /var/discourse
    git pull
    ./launcher rebuild app

```

What is this additional `git pull` for and why don’t you recommend it in the manual?

---

<div class="post-metadata">

### Author: ![Jagster](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/jagster/32/192154_2.png) [@Jagster](https://meta.discourse.org/u/Jagster)
#### Post date: [January 15, 2025, 8:15am UTC](https://meta.discourse.org/t/manually-update-discourse-and-docker-image-to-latest/23325/302 "2025-01-15T08:15:17Z")

</div>

It is an old relic and not needed anymore. Rebuild does it.

---

<div class="post-metadata">

### Author: ![tvavrda](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/tvavrda/32/480674_2.png) [@tvavrda](https://meta.discourse.org/u/tvavrda)
#### Post date: [January 15, 2025, 8:20am UTC](https://meta.discourse.org/t/manually-update-discourse-and-docker-image-to-latest/23325/303 "2025-01-15T08:20:05Z")

</div>

I make a PR?

---

<div class="post-metadata">

### Author: ![tvavrda](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/tvavrda/32/480674_2.png) [@tvavrda](https://meta.discourse.org/u/tvavrda)
#### Post date: [January 15, 2025, 9:11pm UTC](https://meta.discourse.org/t/manually-update-discourse-and-docker-image-to-latest/23325/304 "2025-01-15T21:11:49Z")

</div>

[https://github.com/discourse/discourse/pull/30801](https://github.com/discourse/discourse/pull/30801)

[https://github.com/discourse/docker\_manager/pull/260](https://github.com/discourse/docker_manager/pull/260)

---

<div class="post-metadata">

### Author: ![david](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/david/32/157490_2.png) [@david](https://meta.discourse.org/u/david)
#### Post date: [January 16, 2025, 11:14am UTC](https://meta.discourse.org/t/manually-update-discourse-and-docker-image-to-latest/23325/305 "2025-01-16T11:14:13Z")

</div>

Merged, thanks @tvavrda!
