> ## Content Index
> Fetch the complete content index at: https://blog.bajonczak.com/llms.txt
> Use this file to discover other available public pages before exploring further.

# How to upgrade a existing docker Image
- URL: https://blog.bajonczak.com/upgrade_docker/
- Published: 2021-05-21T22:00:00.000Z
- Updated: 2022-10-23T15:30:12.000Z
- Author: Sascha Bajonczak
- Tags: DevOps

Sometimes I must upgrade my local docker images from a public repo. The best way to update an existing container with the newest image is to download the latest image and launch a new container with the same configuration. Follow the steps listed below to update your container with the newest Docker image.

# Check Current Version

Verify you have an outdated image, by listing the images on your system with the command:

```bash
sudo docker images

```

The output displays downloaded images and their tags (the tag will given mostly the latest version number. In this example below I use the tag **latest**.

![](https://notes.bajonczak.com/assets/img/imageslist.6fe95f1b.jpg)

# Pull the Latest Image

Now you must first download the newer version of the image using the docker pull command:

```bash
docker pull buanet/iobroker:latest

```

By default, Docker pulls the latest version. To ensure it does so, you can add the :latest tag.

# Launch a New Updated Container

Once you downloaded the latest Docker image, you need to stop and remove the old container. Then, create a new one with the latest image.

1. Find the name of the running container with the outdated image by listing the containers on the system:

```bash
docker ps

```

![](https://notes.bajonczak.com/assets/img/dockerps.7a83b099.jpg)

in this output I will se my known Image. So now I pick the **Container ID** to stop and remove the container.

1. Stop and remove the existing container so you can launch a new one under the same name:

```bash
docker stop [container_id]

```

```bash
docker rm [container_id]

```

1. Recreate the container with the docker run command and the wanted configuration, using the updated Docker image:

```bash
docker run --name=[container_name] [options] [docker_image]

```

This is a small run command. Sure you can now use your own run command for now. To attach the mount volumens and so on. I prefer for my home server **docker-compose**, because it's simple to use and has now overhead for me.

1. You can check whether your container has been updated with the latest Docker image by listing the containers with:

# Conclusion

With this handy howto you have updates your docker images very quickly.