Octoprint on Docker Refuses to Start Unless Printer turned on, Webcam connected

Hello

I installed Octoprint on Docker and it ran flawlessly until I restarted the raspberry pi and all other containers started normally except for Octorpint and I realized that it won't start unless the printer is on and webcam are connected to USB. If I turn on the printer and try to start Octorpint then there are no issues (as long as webcam is connected to usb also)

I was wondering if this is a normal behavior and if there is a workaround to get octoprint docker instance to start regardless if printer is on or not. Below are my docker-compose configuration:

octoprint:
container_name: octoprint
image: octoprint/octoprint
restart: unless-stopped
environment:
- TZ=Etc/UTC
- ENABLE_MJPG_STREAMER=true
- MJPG_STREAMER_INPUT=-r HD -f 20
- CAMERA_DEV=/dev/video0
ports:
- "9985:80"
devices:
- /dev/ttyUSB0:/dev/ttyACM0
- /dev/video0:/dev/video0
volumes:
- ./volumes/octoprint:/octoprint
networks:
- iotstack_nw

The error that I get in Portainer when I try to start Octoprint manually is: " Failure
error gathering device information while adding custom device "/dev/ttyUSB0": no such file or directory"

Thanks

This is how docker works. You can't map a device from host to container if it doesn't exist.

I've heard about the internet that you can setup some udev-type rules and configuration to make sure that there's something there for the container to use when it starts up.