The Nautilus DevOps team possesses confidential data on App Server 1 in the Stratos Datacenter. A container named ubuntu_latest is running on the same server.
Copy an encrypted file /tmp/nautilus.txt.gpg from the docker host to the ubuntu_latest container located at /usr/src/. Ensure the file is not modified during this operation.
Step-by-Step Instructions
1. SSH into Application Server 1
ssh steve@stapp01
(Enter the password when prompted)
2. Switch to root or use sudo
sudo su -
or prefix all commands with sudo
3. Verify the container is running
sudo docker ps | grep ubuntu_latest
If the container isn't running, start it:
sudo docker start ubuntu_latest
4. Verify the source file exists on the host
ls -la /tmp/nautilus.txt.gpg
5. Copy the file to the container
Use the docker cp command to copy the file from the host to the container:
sudo docker cp /tmp/nautilus.txt.gpg ubuntu_latest:/usr/src/
Syntax: docker cp <source_path> <container_name>:<destination_path>
6. Verify the file was copied successfully
Check that the file exists inside the container:
sudo docker exec ubuntu_latest ls -la /usr/src/nautilus.txt.gpg
7. Verify the file was not modified
Compare the file checksums on the host and inside the container:
On the host:
md5sum /tmp/nautilus.txt.gpg
Inside the container:
sudo docker exec ubuntu_latest md5sum /usr/src/nautilus.txt.gpg
The checksums should match, confirming the file was not modified.
Complete Execution Summary
# SSH to App Server 1
ssh steve@stapp01
# Verify container is running
sudo docker ps | grep ubuntu_latest
# Copy the file
sudo docker cp /tmp/nautilus.txt.gpg ubuntu_latest:/usr/src/
# Verify file exists
sudo docker exec ubuntu_latest ls -la /usr/src/nautilus.txt.gpg
# Verify file integrity (checksums should match)
md5sum /tmp/nautilus.txt.gpg
sudo docker exec ubuntu_latest md5sum /usr/src/nautilus.txt.gpg
Key Points
- docker cp preserves the file exactly as-is (no modifications)
- The destination path
/usr/src/must exist inside the container - If the destination directory doesn't exist, you'll get an error
- You can also specify a different filename in the destination if needed
Top comments (0)