<p>Docker doesn't recommend running an apt-get upgrade and dist-upgrade on a docker image as many of the &quot;essential&quot; packages from the partent image cannot upgrade inside an unprevileged container. take a look at the <a href="https://docs.docker.com/develop/develop-images/dockerfile_best-practices/" rel="nofollow noreferrer">Docker best practices</a></p>

CC BY-SA 4.0
2020-11-07T08:33:07.010Z
2020-11-07T08:33:07.010Z
sridhar pandurangiah
<p>That is not good design to have docker or any lib update after logging into the container. As mentioned by Andrea Giaime Bodei , you need to update the base image in the Dockerfile and rebuild the image. The docker images are immutable.</p>
<pre><code># Download base image ubuntu 20.04
FROM ubuntu:20.04

# LABEL about the custom image
LABEL maintainer=&quot;abcd@me.com&quot;
LABEL version=&quot;0.1&quot;
LABEL description=&quot;This is custom Docker Image for \
the test&quot;
</code></pre>

CC BY-SA 4.0
2020-11-06T19:02:23.493Z
2020-11-06T19:02:23.493Z
Suresh Thomas
<p>I have a host ubuntu 20.04 running my software on docker with a container derivated from ubuntu 18.04. I would like to use ubuntu 20.04 for several reasons (like the better software on 20.04).
If I run do-release-upgrade on the container terminal I receive the following:
&quot;do-release-upgrade
Checking for a new Ubuntu release
You have not rebooted after updating a package which requires a reboot. Please reboot before upgrading.&quot;
Rebooting the container or rebooting the host machine does not solve the problem.</p>

CC BY-SA 4.0
2020-11-05T11:34:23.913Z
if you have the dockerfile, and you are able to rebuild the image, you could just change the `FROM:ubuntu` command at the top of the dockerfile. You can use tags such as `latest` or pin it to a specific version
Milan Markovic
<docker><containers><linux><ubuntu>
Can I upgrade a docker image/container from buntu 18.04 to ubuntu 20.04?
Andrea Giaime Bodei
# Can I upgrade a docker image/container from buntu 18.04 to ubuntu 20.04?

(Asked by: username_0 on 2020-11-04)

I have a host ubuntu 20.04 running my software on docker with a container derivated from ubuntu 18.04. I would like to use ubuntu 20.04 for several reasons (like the better software on 20.04).
If I run do-release-upgrade on the container terminal I receive the following:
"do-release-upgrade
Checking for a new Ubuntu release
You have not rebooted after updating a package which requires a reboot. Please reboot before upgrading."
Rebooting the container or rebooting the host machine does not solve the problem.

**Tags:** docker, containers, linux, ubuntu

> **Comments:**
> **username_1**: if you have the dockerfile, and you are able to rebuild the image, you could just change the `FROM:ubuntu` command at the top of the dockerfile. You can use tags such as `latest` or pin it to a specific version  

---

## 2 answers

### Answer by username_2 on 2020-11-07. Score: 1

Docker doesn't recommend running an apt-get upgrade and dist-upgrade on a docker image as many of the "essential" packages from the partent image cannot upgrade inside an unprevileged container. take a look at the [Docker best practices](https://docs.docker.com/develop/develop-images/dockerfile_best-practices/)


---

### Answer by username_3 on 2020-11-06. Score: 0

That is not good design to have docker or any lib update after logging into the container. As mentioned by username_0 , you need to update the base image in the Dockerfile and rebuild the image. The docker images are immutable.
# Download base image ubuntu 20.04
FROM ubuntu:20.04

# LABEL about the custom image
LABEL maintainer="abcd@me.com"
LABEL version="0.1"
LABEL description="This is custom Docker Image for \
the test"


---

