Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Registering as CMD not working #143

Open
PeteWilliams opened this issue Apr 20, 2022 · 0 comments
Open

Registering as CMD not working #143

PeteWilliams opened this issue Apr 20, 2022 · 0 comments

Comments

@PeteWilliams
Copy link

I should start by saying I am new to Docker and it is most likely something I am doing wrong rather than an issue with the script!

I have systemctl start/stop working, but enabled services do not restart when the container restarts. I see from the documentation that I need to set the CMD attribute in order for this to work.

Using the code provided in the docs…

docker commit -c "CMD ['/usr/bin/systemctl']"  -m "<comment>" <container> <new-image>

…I made a commit, then ran a new container from that image. However, the container will not start. When I check the log, it shows:

{"log":"/bin/sh: 1: [/usr/bin/systemctl]: not found\n","stream":"stderr","time":"2022-04-20T19:47:44.178390159Z"}

I can confirm that /usr/bin/systemctl does exist in the original container, so I presume it should exist in the new one created from the image. Though I'm not sure how I can check this as I can't start the container.

Having run docker inspect, I can see the CMD attribute is set as follows:

            "Cmd": [
                "/bin/sh",
                "-c",
                "['/usr/bin/systemctl']"
            ],

I wonder if something has gone wrong here as it's showing '-c' as a value, when I think that should have just been a flag passed to the commit command? Though perhaps I'm barking up the wrong tree…

Any ideas what I might be doing wrong? Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant