How to access files in docker container

angryTom
Release: 2020-03-16 17:56:08
Original
11048 people have browsed it

How to access files in docker container

How to access the files in the docker container

1. You can access the files in the docker container Copy the file, then copy it back after processing. The specific operations are as follows:

1. How to download the file from the docker container:

docker cp container_created:path <path>
Copy after login

Among them: is the local storage path of.

2. How to upload files from the local machine to the docker container

docker cp <path> container_created:path
Copy after login

Example:

$docker ps
CONTAINER ID        IMAGE                                         COMMAND             CREATED 
        STATUS              PORTS               NAMES
 266f4acef99b        reg.docker.alibaba-inc.com/alibase/alios7u2   "/sbin/init"        4 hours ago         Up 4 hours
$docker cp 266f4:/root/feedback_venv/feedback_venv.zip /Users/Downloads/
Copy after login

2. You can also enter the container and perform operations:

sudo docker exec -it container_created /bin/bash
Copy after login

For more related tutorials, please pay attention to the docker tutorial column on the PHP Chinese website.

The above is the detailed content of How to access files in docker container. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template