How to list files in a stopped Docker container

This answer to another question shows how to start a stopped container with another command. Here are the commands to list files in a stopped container.

  1. Commit the stopped container to a new image: test_image.
    • docker commit $CONTAINER_ID test_image
  2. Run the new image in a new container with a shell.
    • docker run -ti --entrypoint=sh test_image
  3. Run the list file command in the new container.
    • docker exec --privileged $NEW_CONTAINER_ID ls -1 /var/log

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)