1

Based on the documentation from Docker, I noticed that if I want to inspect the content files of my Elasticsearch container, I need to use the run command with the -it tag. However, after some Googling someone also recommended that I use sh in my command (link in background section). I understand that sh is used to create a shell for me to interact with, but how does it work under the hood? Does it link together with the tty that is created from the -it tag? Is sh referring to the linux-based sh command, a docker sh command, a path, or something entirely different? How does docker know what I mean by sh and where can I find documentation on this?

I used this post as a reference for knowing what command to use: How to see docker image contents

The command I mentioned in my post:

$ docker run -it docker.elastic.co/elasticsearch/elasticsearch:7.3.1 sh
Kate Orlova
  • 3,225
  • 5
  • 11
  • 35
Nabil Khan
  • 13
  • 3

1 Answers1

2

sh denotes the command to run within the container (strictly speaking, this is only true if there is no ENTRYPOINT specified in the image).

There must be a sh executable contained in the image in the PATH. Alternatively you may specify any other executable that is available in the image.

Henry
  • 42,982
  • 7
  • 68
  • 84