How to Set Up Automatic Restart for Docker Containers?

0
4
Asked By CuriousCat42 On

I've only been using Docker Desktop for a couple of days, so I'm still figuring things out. I have Pi-hole running with Unbound in a Docker container, and I want to ensure it restarts automatically if anything happens. When I go into the terminal for the Pi-hole container and try running the command `docker update --restart unless-stopped Pi-hole_2`, I get an error saying `/bin/sh: docker: not found`. I'm confused because it seems like none of the commands are working in this terminal. I even installed Ubuntu 24.04 thinking I needed a different setup. Can anyone help me understand what I'm doing wrong? I have Unraid too, and the terminal for each Docker works fine there.

2 Answers

Answered By HelpfulHarry On

Exactly! When you open the terminal in Docker for a specific container, you’re in that container’s shell, not the host's. You need to go back to your main terminal or command line interface on your host where Docker is actually installed, then run your `docker update` command there.

Answered By TechieTina On

It sounds like you're trying to run Docker commands inside your Docker container, which won't work. Docker commands can only be run from the host system where Docker is installed. So, you need to exit the Pi-hole container's terminal and run your command from the Docker Desktop console on your host machine instead.

Related Questions

LEAVE A REPLY

Please enter your comment!
Please enter your name here

This site uses Akismet to reduce spam. Learn how your comment data is processed.