millions-rain-63833
08/05/2024, 11:10 AM@pulumi/docker-build
and running this image via @pulumi/docker
. I occasionally struggle with the Docker state in the stack and am unsure if this is due to the maturity of the packages or my implementation (I'm not doing anything unusual).
Here's an example of what I'm experiencing:
1. My image is built and pushed to the Docker Hub registry.
2. I use build image ref
as the name for the docker.RemoteImage
pulled from Docker Hub.
3. The image is deployed to the container, and everything works fine.
4. Subsequent Pulumi runs show no changes, which is great.
However, when I change the Docker provider name, things start to fall apart. This change naturally replaces/updates the containers using this provider, but it results in the following error:
docker:index:Container (dev-server-02-run-server-container):
error: 1 error occurred:
* Unable to create container: Error response from daemon: Conflict. The container name "/server-dev" is already in use by container "8486e48261ca160e4b63640f050d1cb763ef7ab1c705e7afe2171d5c9ca5f992". You have to remove (or rename) that container to be able to reuse that name.
I'm not sure if I'm doing something wrong or if there's a better way to adjust my workflow. I find myself spending a lot of time dealing with stack Docker states, where I have to manually delete resources and reinitialize them.
Does anyone have any thoughts or advice on how to handle this more efficiently?
Thank you!little-cartoon-10569
08/05/2024, 8:57 PMname
arg (part of parameter 2 to a constructor), thereby removing the random string that helps ensure name uniqueness. Find the place where you're setting the name and remove it: allow Pulumi to avoid this problem for you.