How to Install a CLI tool inside the container

I am running docker on windows 10. I have installed a Hapi FHIR Server on one docker container. Now I want to install a CLI tool in the same container so that I can download some codesystem(database). I am not very familiar with the docker exec process and whatever I have attempted it results in an error.

Here is what I have done so far.

  1. Downloaded the zip file from the following location.
    Releases · hapifhir/hapi-fhir · GitHub
    2)Next I need to execute the following command

"but it needs to be in the docker container where the fhir server is installed. and I have no clue how to do that"

The commands I have tried and the errors I got are as follows

docker exec -it eed54939c hapi-fhir-cli
error: :unable to start container process. “hapi-fhir_cli” executable file not found in $path: Unknown

docker exec -it eed54939c ./hapi-fhir-cli
error: unable to start container process “./hapi-fhir-cli”: .stat ./hapi-fhir-cli no such file or directory:unknown.

I have tried few other command but they all fail.

Can someone please help. Here is some information.
Container ID:eed54939c

Please share which image you use, in case you build the image yourself, please share the Dockerfile.

Most Docker images are Linux based and include at least a sh shell, if not bash. Try

docker exec -it <cid> sh

Within the container, you can usually download files with the curl or wget command.

If you want to persist or export data to the host, you should mount a folder from the host into the container.

It‘s best practice that application and database run in different containers, you could probably expose ports of the DB (-p) or share a Docker network with DB and a new CLI container.

As @meyay states, we know very little about your system, you need to share more info for better support.

Hi Metin,
Here is the git that I used to build the Hapi server. I did not make any changes to the default.

So what I need to do next is get terminology server. For this I need to get hapi-fhir-cli tool.

The instructions I am being given is that terminology server has to be inside the same container on which I am running the Hapi server.

FYI I cant even run a simple sh command using exec.

c:>docker exec -it eed54939c40a sh
OCI runtime exec failed: exec failed: unable to start container process: exec: “sh”: executable file not found in $PATH: unknown

You will either need to search for another image, or modify the Dockerfile to use a base image for the last FROM instruction that is not distroless. Furthermore, you will need to extend the Dockerfile to build the jar files for the cli or download the release from github and include it into the final image (and whatever dependency the cli has)

1 Like

Need Help? Please see: Getting Help · hapifhir/hapi-fhir Wiki · GitHub

I think the Google group, also mentioned by the CLI tool, is the best place to ask for help.

After checking the link, I agree with @meyay, that a Dockerfile mod is the best approach. That has probably been discussed before in that group.