I recently needed to do some troubleshooting of a Docker container that was using an Alpine base Docker image. The error I ran into, “Can’t run script file in Docker, no such file or directory”.
Alpine images are great because of their small footprint that removes all of the unnecessary bells and whistles of much heavier, more fully-featured based image. However, troubleshooting an Alpine image can be a little trickier. I, like most developers, want a fast feedback cycle so I like to avoid troubleshooting Docker by editing my Dockerfile and rebuilding images over and over again.
I needed to first understand what files where in my container. By default, Alpine images use Busybox, which does not contain a full shell. By running the following command in my terminal I am able to see what files exist in my container:
docker run my-image /bin/busybox ls -la /
OR in a Dockerfile
...
CMD /bin/busybox ls -la /
...
I can now traverse my container to determine what files/folders exist to continue down the troubleshooting rabbit hole.