Docker Community Forums

Share and learn in the Docker community.

How to stop missing volumes prevent containers starting?

Hi all,

Hope you’re well

I have a container which won’t start when a volume path is missing (e.g. network path not found)

Until now I’ve been commenting in/out the offending path when it is/isn’t accessible but there must be a better way - would someone be kind enough to point me to a better solution?

Brainstorming, I’m thinking:

  • Symbolic link(s)
  • Separate linked container (possible?)
  • Dynamic/hotswappable volume paths (possible?)

Just reading through docs so hopefully some of these thoughts are possible

Hope to hear back

Sincerely

  jellyfin:
    environment:
      - PUID=1000
      - PGID=1000
      - TZ=Europe/London
    image: linuxserver/jellyfin
    ports:
      - 8096:8096
    restart: unless-stopped
    volumes:
#    - /Volumes/synology/gtd/home/reference:/-data/jellyfin/synology
      - ~/Downloads/-data/-config/jellyfin:/config
      - ~/Downloads/-data:/-data/jellyfin/apple

use sudo docker update --restart=no <container_id> to update --restart flag of the container. Now you can stop the container. You should be able to just use docker stop and then docker rm to make sure the container doesn’t restart when the daemon restarts.

I guess something like –devices but for network drives would be useful…?

--devices is better documented here IMO

Hi,

Thanks for reply

Sorry if I wasn’t clear enough in my OP but I’m looking for a way to add/remove volumes without having to edit my compose file and/or start/stop my container

Essentially I want my volumes to be optional

Hope to hear back

Sincerely

PS I’m using docker-compose up which, to my knowledge, stops/starts containers so the issue you highlight is a non-issue for me :slightly_smiling_face: