How to push a container in a stopped state?

For reasons explained here I’m trying to add a second identical container to my release so that I can manually switch between entrypoint commands.

The problem is that supervisor tries to start the container, but the port is already taken (because the other docker-compose.yml file is identical, but for the entrypoint command) I would prefer that this container initializes in a ‘stopped’ state, and then I can manually turn off the first container and turn on the stopped identical one.

Is there a way to set the desired state of a service to ‘stopped’?

Otherwise, I get endless messages in console and it likely takes compute resources that I would rather not expend to try to initialize the impossible to start container.

17.10.19 20:08:24 (+0000) Starting service 'your_service sha256:RAa198f2c7da4bcd53x590101aO42Pe3c0f93Eba5d2fe0701113fa59baf2b738'
17.10.19 20:08:24 (+0000) Starting service 'your_service sha256:RAa198f2c7da4bcd53x590101aO42Pe3c0f93Eba5d2fe0701113fa59baf2b738'
17.10.19 20:08:27 (+0000) Starting service 'your_service sha256:RAa198f2c7da4bcd53x590101aO42Pe3c0f93Eba5d2fe0701113fa59baf2b738'
17.10.19 20:08:31 (+0000) Starting service 'your_service sha256:RAa198f2c7da4bcd53x590101aO42Pe3c0f93Eba5d2fe0701113fa59baf2b738'
17.10.19 20:08:39 (+0000) Starting service 'your_service sha256:RAa198f2c7da4bcd53x590101aO42Pe3c0f93Eba5d2fe0701113fa59baf2b738'
17.10.19 20:08:55 (+0000) Starting service 'your_service sha256:RAa198f2c7da4bcd53x590101aO42Pe3c0f93Eba5d2fe0701113fa59baf2b738'
17.10.19 20:09:28 (+0000) Starting service 'your_service sha256:RAa198f2c7da4bcd53x590101aO42Pe3c0f93Eba5d2fe0701113fa59baf2b738'
17.10.19 20:10:32 (+0000) Starting service 'your_service sha256:RAa198f2c7da4bcd53x590101aO42Pe3c0f93Eba5d2fe0701113fa59baf2b738'
17.10.19 20:12:40 (+0000) Starting service 'your_service sha256:RAa198f2c7da4bcd53x590101aO42Pe3c0f93Eba5d2fe0701113fa59baf2b738'
17.10.19 20:16:56 (+0000) Starting service 'your_service sha256:RAa198f2c7da4bcd53x590101aO42Pe3c0f93Eba5d2fe0701113fa59baf2b738'
17.10.19 20:25:29 (+0000) Starting service 'your_service sha256:RAa198f2c7da4bcd53x590101aO42Pe3c0f93Eba5d2fe0701113fa59baf2b738'
17.10.19 20:40:29 (+0000) Starting service 'your_service sha256:RAa198f2c7da4bcd53x590101aO42Pe3c0f93Eba5d2fe0701113fa59baf2b738'
17.10.19 20:55:29 (+0000) Starting service 'your_service sha256:RAa198f2c7da4bcd53x590101aO42Pe3c0f93Eba5d2fe0701113fa59baf2b738'
17.10.19 21:10:30 (+0000) Starting service 'your_service sha256:RAa198f2c7da4bcd53x590101aO42Pe3c0f93Eba5d2fe0701113fa59baf2b738'
17.10.19 21:25:30 (+0000) Starting service 'your_service sha256:RAa198f2c7da4bcd53x590101aO42Pe3c0f93Eba5d2fe0701113fa59baf2b738'
17.10.19 21:40:30 (+0000) Starting service 'your_service sha256:RAa198f2c7da4bcd53x590101aO42Pe3c0f93Eba5d2fe0701113fa59baf2b738'
17.10.19 21:55:31 (+0000) Starting service 'your_service sha256:RAa198f2c7da4bcd53x590101aO42Pe3c0f93Eba5d2fe0701113fa59baf2b738'

I could modify the identical container’s port mapping, but I use it for a sometimes listening ssh daemon that allows for file transfer on an as-needed local wifi hotspot. Changing that value would mean that my other scripts would have to know if they were talking to standard container, or identical container in order to get files off the devices, not a complication I want to have to bother with.

Hey @cnr

Currently there’s no way to do this, but we are working on a set of features which should make things like this possible. Unfortunately I don’t have a timeframe for this, but stay tuned.

As for your situation, would it be possible to include two different versions of your application in a single container, and switch provisionally between them?

1 Like

Yeah, that’s a pretty good idea… I’ll just add a line to my entrypoint script that uses an environment variable to figure out how to start up.

That will work for now :slight_smile:

Glad I could help!

1 Like