3 ms·
So one thing that I didn't read here is how it works with environment variables. Imagine you launch a container with FOOD=fries and DRINK=beer. The container d
by WirelessGigabit 4y ago
So one thing that I didn't read here is how it works with environment variables.
Imagine you launch a container with FOOD=fries and DRINK=beer. The container doesn't set defaults for those variables, it does have one for DESSERT=ice-cream.
The container runs with FOOD=fries, DRINK=beer & DESSERT=ice-cream. An update comes along, and the container now has a default for DRINK=wine and switches to DESSERT=creme-brulee.
You update the container. What do you expect to happen with DRINK & DESSERT? DRINK remains beer, fine we chose that. But DESSERT also remains ice-cream, even though we didn't explicitly say that. The problem is that Docker (well, the surrounding tooling) cannot distinguish between your input and the container's default. They all get set in the `env` section of the container.
So you update the container and end up with FOOD=fries, DRINK=beer & DESSERT=ice-cream.
I get around this with using ansible with the Docker collection from the community [0]. This has a separate input and when it recreates the container it only takes into account the environment variables I set, and doesn't provide the other ones, so they become the container's default.
Many containers have things like PYTHON_VERSION=3.11.1 PYTHON_PIP_VERSION=22.3.1 PYTHON_SETUPTOOLS_VERSION=65.5.1 PYTHON_GET_PIP_URL=https://github.com/pypa/get-pip/raw/66030fa03382b4914d4c4d0896961a0bdeeeb274/public/get-pip.py https://github.com/pypa/get-pip/raw/66030fa03382b4914d4c4d08... PYTHON_GET_PIP_SHA256=1e501cf004eac1b7eb1f97266d28f995ae835d30250bec7f8850562703067dc6 in there.
PS: How do I get Podman 4 on Ubuntu?
[0] https://docs.ansible.com/ansible/latest/collections/community/docker/index.html https://docs.ansible.com/ansible/latest/collections/communit...
- Arnavion 4y agoThe container service unit will do `podman run -e FOOD=dries -e DRINK=beer whatever-image:latest` podman-auto-update.service will pull the new `whatever-image:latest` image, restart the container service (which `stop`s and `rm -f`s the container), and `image prune -f` to remove the previous `whatever-image:latest`. The restarted container service will continue to run `podman run -e FOOD=dries -e DRINK=beer whatever-image:latest`. So you end up with `FOOD=fries DRINK=beer DESSERT=creme-brulee`
- WirelessGigabit 4y agoThank you! I really appreciate this. It seems to do what I want it to do. I checked for Podman 4 on Ubuntu, but that's a whole other can of worms. And I need 4 for IPv6 support.