How to restart octoprint in official docker container

I have installed the octoprint docker container. There was no default setting for octoprint restart command on install and following the 'non container' instructions for restart command (sudo service restart octoprint) this failed as sudo isn't installed. Octoprint is also not installed as a service when accessing the docker container.

Is there a preferred command to restart octoprint within the docker container?

i'm looking for a solution for that as well
couldn't understand the way to restart the container or the service inside with a command in the octoprint

I suppose there's always the Docker documentation on this.

I assume they mean the commands to pass into the application setting to restart octoprint within the inside of docker, since the OS is pretty stripped down...

That's exactly the problem. Ideally it'd be great to restart the container, but the command is sent withint the container and there is no systemd/init.d setup within for the images I've been using to address this.

All I can think to do is kill the process and restart it.

I'm not sure you can restart a container from within a container.


yeah, it's definitely using a very lightweight docker image. It would be nice if it ran a small os with possibly systemd to intiate restarts of the service.

Haven't tested yet, but you could :

  • create your own Dockerfile (enhancing the base octoprint image = using it as the FROM in your dockerfile)
  • add the docker-ce-cli client (per the docker documentation about adding docker inside debian = add repository, gpg key, ... + apt-get install docker-ce-cli)
  • mount the docker socket when starting your enhanced octoprint container (with an additional -v /run/docker.sock:/run/docker.sock)
  • reconfigure octoprint to use the docker commands ("docker restart octoprint")

Provided there is no issue about installaing docker-ce-cli inside the used debian image, this should work flawlessly (this is what images like "portainer" are doing in order to be able to administrate hosts' containers from the portainer image itself).

I am a total newbie, so not sure if this adds anything or not, but I am running a container based on nunofgs/docker-octoprint, and in that case this command works perfectly:

supervisorctl restart octoprint

Now testing the official octoprint/octoprint image, and the above does not work anymore...maybe someone smarter than me can make something out of that..

Hopefully someone will repackage the docker image without the stripped down OS so that we can restart with OctoPrint. Meanwhile, I'll do a restart with Portainer...

I have a command line that works for me now. I did some inquiry on the OctoPrint/octoprint-docker github site and after a couple of pointers and further web searches this is what I came up with:

redirfd -w 2 /dev/null s6-svscanctl -t /var/run/s6/services


I struggled with this when moving to the official image about 2 months ago and found dockermon ( to be a good solution... an independent image that can control any other image (including Octoprint) with a simple GET call (among other alternatives)... works perfectly for me e.g. restarting Octoprint when upgrading plugins.

Thanks! It's works flawlessly

Just came across this for updating a plugin, using octoprint/octoprint:1.6.1 in docker-compose.
For me, killall octoprint worked as the restart command, since keeping it up is docker's job :wink:

I had a similar issue because I installed octoprint on Raspberry and then backed it up and restored on a docker.
The solution was to add this on the Settings -> Server -> Restart OctoPrint:
s6-svc -r /var/run/s6/services/octoprint
hope this helps :slight_smile: