GitLab Commit is coming up on August 3-4. Learn how to innovate together using GitLab, the DevOps platform. Register for free: gitlabcommitvirtual2021.com

Commit c4945ff2 authored by Ruben ten Hove's avatar Ruben ten Hove 🚵
Browse files

Update content/blog/device_in_docker_stack.md

parent 304e4a6b
......@@ -29,7 +29,7 @@ Then we need its assigned major and minor identifiers. These may vary per device
> The container we use for this needs udevadm installed. You can do that for each run, or setup a image somewhere which has it installed from the `udev` package. You can also use the image I've created in the example above.
Next we need the new container in which we are going to make the device available. It is quite convoluted to get that going with Docker Swarm, and I haven't seen a simpler way without reducing its robustness.
Next we need the new container in which we are going to make the device available. It is quite convoluted to get that going with Docker Swarm.
```yaml
- "OLD_CONTAINER=${CI_PROJECT_NAME}_homeassistant.1.$(docker service ps -f name=${CI_PROJECT_NAME}_homeassistant.1 ${CI_PROJECT_NAME}_homeassistant -q --no-trunc | head -n1)"
......@@ -52,6 +52,13 @@ Next we need the new container in which we are going to make the device availabl
done
```
You can replace the above with the following to assume it will have replaced the container within a minute. This is because the above may fail at times.
```yaml
- docker stack deploy -c docker-compose.yml --prune ${CI_PROJECT_NAME}
- sleep 60 # Sleep for 1 minute and assume our new container will be up
```
Finally we allow the device to be used by the new home assistant container, and create the device node in there as well.
```yaml
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment