T O P

  • By -

pigers1986

"docker container stop XXX" , where XXX is docker name ?


towerrh

The problem I run into is that the container I would like to do this on isnt the host. The docker command doesnt work becuse the cli isnt on it. The way that I understand it, I will have to pass the docker.sock. But im still lost how to get docker -cli installed.


pigers1986

so ? ssh other_server "sudo docker container stop XXX" rsync -avh other_server:/path/to/data /local/path/ ssh other_server "sudo docker container start XXX" side notes: 1. exchange SSH key between servers , so you do not have password to enter 2. it's assumed that user logging to remote server is allowed to use sudo


towerrh

I cannot stop another container from inside another container I need to stop it


pigers1986

ah - misunderstood you at one part you try to expose file "/usr/bin/docker" to the backup container ? so your command needs to expand with "docker run .... -v /usr/bin/docker:/usr/bin/docker -v /var/run/docker.sock:/var/run/docker.sock ..." plus you need to chown /var/run/docker.sock to your container ID ? so you have docker cli inside ?


towerrh

No worries! I'm sorry I'm not explaining it properly. Correct! The only thing I don't have is the docker cli.


pigers1986

expose docker binary and try !


Manibalajiiii

If you know the container name , you directly use the containerd to handle it , ctr containers list -a, ctr tasks kill . Problem with this is you have to recreate the container , if you are that desperate to handle this without the docker CLI then this is the way.


fuzzy812

Docker compose up and down , better garbage collection