How to stop docker under Linux

前端 未结 3 539
北荒
北荒 2021-01-30 01:44

My version of OS Ubuntu 16.04. I want to stop docker, so I run in the terminal:

sudo systemctl stop docker

But this commands doesn

相关标签:
3条回答
  • 2021-01-30 01:56

    if you have no systemctl and started the docker daemon by:

    sudo service docker start
    

    you can stop it by:

    sudo service docker stop
    
    0 讨论(0)
  • 2021-01-30 02:02

    In my case, it was neither systemd nor a cron job, but it was snap. So I had to run:

    sudo snap stop docker
    sudo snap remove docker
    

    ... and the last command actually never ended, I don't know why: this snap thing is really a pain. So I also ran:

    sudo apt purge snap
    

    :-)

    0 讨论(0)
  • 2021-01-30 02:07

    The output of ps aux looks like you did not start docker through systemd/systemctl.

    It looks like you started it with:

    sudo dockerd -H gridsim1103:2376
    

    When you try to stop it with systemctl, nothing should happen as the resulting dockerd process is not controlled by systemd. So the behavior you see is expected.

    The correct way to start docker is to use systemd/systemctl:

    systemctl enable docker
    systemctl start docker
    

    After this, docker should start on system start.

    EDIT: As you already have the docker process running, simply kill it by pressing CTRL+C on the terminal you started it. Or send a kill signal to the process.

    0 讨论(0)
提交回复
热议问题