I have a docker container running in portainer. I have added an SMB volume to the container. Does anyone know how I can update this docker container using docker-compose without undoing my changes? Thanks
@selfhosted @Docker @portainerio
@LordChaos82 @selfhosted you can create a compose file, and in it, state the volumes are external (so compose knows to reuse existing volumes).
You’d mount the volume in the docker-compose.yml using the
volumes:
node.You can try to automatically generate the compose file via this command:
docker run --rm \ -v /var/run/docker.sock:/var/run/docker.sock:ro \ ghcr.io/red5d/docker-autocompose \ your-current-container-name-or-id-goes-here \ another-container-should-there-be-more-than-one
Don’t add the mount in the container. Just open Portainer, go to your container, click “Duplicate/Edit”, scroll down, and do this:
@Dirk thanks. That’s how I did it but I am not sure if updating using docker compose would overwrite it. Portainer is running on a VM so I will make sure to snapshot it and try so I can restore it if needed.
You’re using Portainer, why manually mess with docker compose?
You can just mount the SMB volume using docker-compose.
I think have some example compose files if you need some example.
@Catsrules Thanks. This specific to Immich. The upload location in the docker-compose is picked from .env file. I, for the life of me, cannot figure out how to mount the portainer SMB volume in the .env file. What I ended up doing was to select the containers using the upload location and edit the volume to attach the SMB share volume from portainer. I hope what I said makes sense. I am just a newbie learning docker right now.