Skip to content

Latest commit

 

History

History
41 lines (25 loc) · 1.51 KB

Copy File to Docker Container.md

File metadata and controls

41 lines (25 loc) · 1.51 KB

Problem Statement

The Nautilus DevOps team has confidential data on App Server 3 in the Stratos Datacenter. A container named ubuntu_latest is running on the same server. Your task is to copy an encrypted file /tmp/nautilus.txt.gpg from the Docker host to the ubuntu_latest container, placing it in the /tmp/ directory. It is crucial to ensure that the file remains unchanged during this transfer process.

Solution

To achieve this, follow these steps:

  1. Copy the File from the Docker Host to the Container

    Use the docker cp command to transfer the encrypted file from the Docker host to the specified path in the ubuntu_latest container. This command ensures that the file is copied directly and accurately without any modifications.

    docker cp /tmp/nautilus.txt.gpg ubuntu_latest:/tmp
  2. Verify the File Transfer

    After copying the file, you can confirm its presence and ensure the transfer was successful by accessing the container and listing the contents of the target directory. Use the docker exec command to open an interactive bash shell inside the container.

    docker exec -it ubuntu_latest /bin/bash

    Once inside the container, navigate to the /tmp/ directory and check for the presence of the file:

    cd /tmp/
    ls

    Expected output:

    nautilus.txt.gpg
    

    This output confirms that the file nautilus.txt.gpg has been successfully copied to the container and is located in the specified directory.