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.
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.
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
docker exec -it <cid> sh
Within the container, you can usually download files with the
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.
@meyay states, we know very little about your system, you need to share more info for better support.
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
########### distroless brings focus on security and runs on plain spring boot - this is the default image
FROM gcr.io/distroless/java17-debian11:nonroot AS default
# 65532 is the nonroot user's uid
# used here instead of the name to allow Kubernetes to easily detect that the container
# is running as a non-root (uid != 0) user.
COPY --chown=nonroot:nonroot --from=build-distroless /app /app
COPY --chown=nonroot:nonroot --from=build-hapi /tmp/hapi-fhir-jpaserver-starter/opentelemetry-javaagent.jar /app
ENTRYPOINT ["java", "--class-path", "/app/main.war", "-Dloader.path=main.war!/WEB-INF/classes/,main.war!/WEB-INF/,/app/extra-classes", "org.springframework.boot.loader.PropertiesLauncher"]
“Distroless” images contain only your application and its runtime dependencies. They do not contain package managers, shells or any other programs you would expect to find in a standard Linux distribution.
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)
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.