1. Use SCP to copy files to the remote server while logged onto the local machine
a. Windows command: pscp.exe c:\origin\ [email protected]:/home/user1
(source of executable: Source file:
b. Linux command: scp /home/origin [email protected]:/home/user1
2. SSH onto remote machine and elevate as a member of the docker group
ssh [email protected]
sudo docker
3. Show Container IDs
[docker@ip-172-31-10-232 user1]#docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
6c65da0f wordpress "docker-entrypoint.s…" 2 weeks ago Up 2 weeks 0.0.0.0:80->80/tcp kimconnect
4. Find attached volume of container
[docker@ip-172-31-10-232 user1]#docker inspect -f '{{ .Mounts }}' 6c65da0f
[{volume 90f86fa4becb6ecdb4b7e39079f6ca35c1397a57a6a375eab5c37ac2f7686f68 /var/lib/docker/volumes/90f86fa4becb6ecdb4b7e39079f6ca35c1397a57a6a375eab5c37ac2f7686f68/_data /var/www/html local true }]
4. Optional: make a backup of the existing volumes
timeStamp=$(date +%Y%m%d-%H%M%S)
sqlVolume="
homeDirectory="/home/user1"/var/lib/docker/volumes/
8927da595268a3ce36386d5e910b4d503e9585f11dd311a2a700d08cf66e3fb9"
apacheVolume="/var/lib/docker/volumes/
90f86fa4becb6ecdb4b7e39079f6ca35c1397a57a6a375eab5c37ac2f7686f68"
tar -C $sqlVolume -czvf $homeDirectory/sqlVolume-$timeStamp.gz _data
tar -C $apacheVolume -czvf $homeDirectory/apacheVolume-$timeStamp.gz _data
chmod 777 $homeDirectory/sqlVolume-$timeStamp.gz $homeDirectory/apacheVolume-$timeStamp.gz
5. Change into the container’s volume
cd /var/lib/docker/volumes/90f86fa4becb6ecdb4b7e39079f6ca35c1397a57a6a375eab5c37ac2f7686f68/_data
6. Copy contents from user into container’s directory
mv /home/user1/piano /home/user1/pianogame.html ./
Categories: