Docker Community Forums

Share and learn in the Docker community.

Is this how this works?

Hey all… looking for some basic guidance…

I have made a bunch of docker instances (at home) on a physical machine (ClearLinux) with a dozen or so docker-run scripts… mounts, ports, net=host, etc…

but each container has to be updated with it’s own docker pull…

so coredns (for example);

docker rm coredns -f; docker system prune -af; sh /root/docker/docker-coredns; docker logs coredns -f

Is that the only way to upgrade a container… so if I have a dozen containers… do I have a dozen of those?

Is that the norm?

Thanks in advance…

Hi

I would use Overview of Docker Compose | Docker Documentation
Its a recipe for your container, so you dont have to think about those docker run commands.

fx. if you want to have a mariadb container with docker-compose:

put this in a docker-compose.yml file:

version: '3.1'
services:
  db:
    image: mariadb:latest
    restart: always
    ports:
      - 3306:3306
    environment:
      MYSQL_ROOT_PASSWORD: example

and then you can do: docker-compose up -d, this will start the container with the above recipe, and if mariadb updates their image you would do:
docker-compose pull (this will pull the new image)
and then again, docker-compose up -d ( which will check for changes in your docker-compose.yml OR image, and re-create your container with the changes)
done :slight_smile:

When you search for images, many of those will include a docker-compose file, and its also best practise to use them, so I think you should get familiar with it.

Or if you want to live on the edge you can try some “auto update container” with
https://containrrr.dev/watchtower/