Home > other >  Docker: Reading files from inside the container without entering it
Docker: Reading files from inside the container without entering it

Time:05-05

I am currently using the

sudo docker exec -it <container_name> /bin/bash

command to enter the container and then

cat <my_file_path>

to display the contents of the file. What one command should I use to display the contents of a file in a container without enter on it? Edit:

sudo docker exec <container_name> cat <my_file_path>

work correct, but remember to use absolute path, because ~/ not work

CodePudding user response:

You can do

sudo docker exec <container_name> cat <my_file_path>
  • Related