docker run starts your containers
There is a ton of info out there, so i wont copy it. Here are some of the links that i found useful
https://docs.docker.com/engine/reference/run/#detached-vs-foreground/
https://stackoverflow.com/questions/49726272/docker-run-why-use-rm-docker-newbie
https://blog.codeship.com/the-basics-of-the-docker-run-command/
Lets break down a few examples
docker run -d –name=”home-assistant” -v /srv/docker/hassconfig:/config -v /etc/localtime:/etc/localtime:ro –net=host homeassistant/home-assistant
-d
This runs the container in the background. If you do not specify this, the container will run in the command window. And when you exit the shell the container will stop.
–name
Gives your container its name. Thats what you see in NAMES in docker ps
-v
Sets up your persistent storage. The format is “path to server storage”:”path to container storage”:[options]. In this example we are mapping /srv/docker/hassconfig on my homeserver to /config on the container. You need one per mapping. In the second mapping in our example :ro specifies Read Only.
–net
Specifies how the container will interact with the host networking. In this example –net-host effectively means the container network is passed through to the host network as is. This might be the easiest/quickest for getting you up.
The last parameter is the container repo image name, homeassistant/home-assistant
One thought on “Guide to docker run”
Comments are closed.