Running commands on non-primary containers




It was mentioned in this thread from April 2017 that support for running commands in non-primary containers was coming in the “near future”. The last mention of this on the forum that I could find was from August of 2017, here. Can you update us on the status of the feature? If it’s available, what is the correct syntax?


I think you can do it already at start-up, but not at an arbitrary time during the container lifetime (e.g. with docker exec). I agree it would be nice to have.

Of course, you could create a custom image that accept commands over HTTP - maybe say it is normally a MySQL server (which binds on the usual MySQL port) and then also it would listen to :10000 to execute commands.

Fancy a side project? :wink:


Thanks, halfer. How do you do it at startup?


See the table here - you need to supply a custom command, which is:

The command used as pid 1 (or args for entrypoint) when launching the container

So, for Apache this would normally be /usr/sbin/httpd -DFOREGROUND, for instance, but you could probably do stuff like /my/sneaky/command && /usr/sbin/httpd -DFOREGROUND as well.