Attach new image to existing container

Typically whenever I want to update a container, I will stop and delete the container, delete the related image, pull the new image and re-create the container. All my data is safely stored on persistent volumes, so the container is updated and all my data is intact.

docker stop phpmyadmin
docker rm phpmyadmin
docker image rm ghcr.io/linuxserver/phpmyadmin

docker pull ghcr.io/linuxserver/phpmyadmin
docker run -d \
 --restart=always \
 --name phpmyadmin \
 -h phpmyadmin \
 -e PUID=1001 \
 -e PGID=1001 \
 -e PMA_ARBITRARY=1 \
 --net=network \
 -p 8082:80 \
 -v phpmyadmin:/config \
 ghcr.io/linuxserver/phpmyadmin

I was wondering if its possible to skip the step where I delete and re-create the container.

So basically what I want to do, is

  1. stop the container
  2. delete the existing image
  3. download the updated image
  4. attach the existing container on the newly downloaded image
  5. start the container

Is this possible?

I tried something like this, and it worked. But I don’t know if its an acceptable method of doing this.

docker stop phpmyadmin
docker rmi -f lscr.io/linuxserver/phpmyadmin
docker pull lscr.io/linuxserver/phpmyadmin
docker start phpmyadmin

We cover updating in the readme of every one of our containers.

I understand that, but obviously there is more than one way to update a container. Also, I can’t find an update section linuxserver/phpmyadmin - LinuxServer.io

We only document how we SUPPORT upgrading. While you may be able to do other things, we don’t support it and won’t discuss it here. docs.docker.com has a plethora of information though.

I introduce to you Pullio:

For all your automated docker container updating needs. I believe it only works with compose. But it works great! I configured mine to update all containers every day at 5am. Enjoy!

Please note that we, LSIO, do not support automatic updating of our containers. Just ask all the irresponsible qbittorrent users who automatically update.