Following is my dockerfile:
FROM python:3.6.5-windowsservercore COPY . /app WORKDIR /app RUN pip download -r requirements.txt -d packages To get list of files in the image, I have tried both the following options, but there is error:
encountered an error during CreateProcess: failure in a Windows system call: The system cannot find the file specified. (0x2) extra info: {"CommandLine":"dir","WorkingDirectory":"C:\\app"...... - Run
docker run -it <container_id> dir - Modify the dockerfile and add CMD at end of dockerfile -
CMD ["dir"], then rundocker run <container_id> dir
How to list all directories and files inside docker?
13 Answers
Simply use the exec command.
Now because you run a windowsservercore based image use powershell command (and not /bin/bash which you can see on many examples for linux based images and which is not installed by default on a windowsservercore based image) so just do:
docker exec -it <container_id> powershell Now you should get an iteractive terminal and you can list your files with simply doing ls or dir
By the way, i found this question :
Exploring Docker container's file system
It contains a tons of answers and suggestions, maybe you could find other good solutions there (there is for example a very friendly CLI tool to exploring containers : )
In your Dockerfile add the below command:
FROM python:3.6.5-windowsservercore COPY . /app WORKDIR /app RUN dir #Added RUN pip download -r requirements.txt -d packages This is what I found helpful in the end. Thanks to Nischay for leading the way. The great thing about this, of course, is that one may examine the files even if the publish fails at a later stage.
# Copy everything... COPY . ./ # See everything (in a linux container)... RUN dir -s # OR See everything (in a windows container)... RUN dir /s