1

I'm setting a backup/ sync within an Ubuntu network using rsync.

Assume that a Desktop (Ubuntu 18.04)-ip: 10.0.0.13
Running a docker with two Containers :

 Client_A: 2001 -> 22/tcp , 8001 -> 80/tcp  
 Client_B: 2002 -> 22/tcp , 8002 -> 80/tcp

All 3 images are ubuntu, apache2 installed and running

dir:

DesktopOS        Container1         Container2
10.0.0.13:80     10.0.0.13:8001     10.0.0.13:8002  
⊢var             ⊢var               ⊢var             
  ⊢www             ⊢www               ⊢www           
    ⊢html            ⊢html              ⊢html          
      ⊢1.txt           ⊢2.txt             ⊢3.txt   

all three txt can be accessed in browser


When i try to pull 3.txt to Container1:

rsync -av -e 'ssh -p 2002' --rsh=ssh [email protected]/var/www/html/ ~/BACKUP/

1.txt has received.


How to access the 3.txt in Container1?

Please use the IP Address since I am simulating a real network, maybe 1 docker on 1 device in the real world.

1
  • This doesn't sound like a typical Docker setup. Normally a Docker container would only run, say, Apache (and not sshd), and if you needed to share files between the host and a container, you'd use the docker run -v option for it. A container's local filesystem shouldn't have anything that needs to be backed up and that you wouldn't mind losing when you need to docker rm it.
    – David Maze
    Feb 14, 2019 at 11:36

1 Answer 1

0

Finally I found I installed ssh only, doesn't install the ssh-server. Otherwise, the firewall blocks the access.

#find out port 22, 2002, 2001 etc. 
#from netstat result, is it listening?
netstat | grep 2002

Install ssh server

sudo apt install tasksel
sudo tasksel install openssh-server

for Firewall:

sudo ufw allow 2001,2002

and it solved, thanks for your patients who try to answer me.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.