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

systemctl disable not disabling service at container restart #164

Closed
JCoupalK opened this issue Jul 1, 2023 · 1 comment
Closed

systemctl disable not disabling service at container restart #164

JCoupalK opened this issue Jul 1, 2023 · 1 comment

Comments

@JCoupalK
Copy link

JCoupalK commented Jul 1, 2023

Inside my docker container running Ubuntu 22.04 when I do:

sudo systemctl disable nginx
sudo systemctl stop nginx

And then outside of it do a docker restart or docker stop and then start

My service comes back up.

But when I do sudo systemctl status nginx after a restart I get this which I found strange:

nginx.service - A high performance web server and a reverse proxy server
    Loaded: loaded (/usr/lib/systemd/system/nginx.service, disabled)
    Active: active (running)

The service is disabled but it somehow comes back up.

My dockerfile has CMD ["/usr/bin/systemctl"]

I'm new to this project so I'm not sure if that's normal behavior or not.

@gdraheim
Copy link
Owner

gdraheim commented Jul 4, 2023

The system startup is actually doing a "systemctl start default.target" which is a symlink doing "systemctl start multi-user.target". In the nginx.service you find a declaration that it is a dependency of the multi-user.target.

The systemctl designers have a funcationality for you however - it is called "systemctl mask nginx".

@gdraheim gdraheim closed this as completed Jul 4, 2023
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

2 participants