Closed eduarddrenth closed 5 years ago
please could you rephrase your ticket more as question or concrete suggestion? It is more like a one-liner now, not stating what you think what should be changed. That would be a start of a clear discussion.
AFAIK the docker image is made as small as possible on purpose; a shell could un-harden the image even?
For interacting with a container it would be very helpfull to have sh and/or bash available as well as some basic shell commands
I personally think a minimal shell is a must. For example payara and postgres images also include that.
as mentioned in the readme these images are based on distroless images the exclusion of a linux shell is very much by design.
To interact with the running container issue docker exec …
commands or use the Java Admin Client to issue shell commands. If you wish to attach your local shell more permanently you can enable the :debug
mode of the distroless image here. This step, however, requires you to work with your own base images, as the official images are designed to be used in production as base images, we will not ship with a :debug
base images for the reasons that Dannes already mentioned.
Most of my shell interaction with the eXist db running in a container, is achieved thru eXist rest api. I mostly use the pattern outlined in following bash script
#!/usr/bin/env bash
IPAddress=$(docker inspect --format='{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' exist)
URL="http://${IPAddress}:8080/exist/rest/db"
function post() {
curl -s \
-H 'Content-Type: application/xml' \
-u 'admin:' \
--data-binary @- "$URL"
}
cat <<EOF | post
<query xmlns='http://exist.sourceforge.net/NS/exist' start='1' max='99' wrap='no'>
<text><![CDATA[
xquery version '3.1';
repo:list() =>
string-join(' ')
]]></text>
</query>
EOF
If you need to interact with the file system on the container, the file module allows you to list move, make directories etc
ok, the reason for me to ask this is I want to get an image with xar's that are already deployed and indexed. OS access would be very welcome here, for example to start and stop exist.
restarting the container will reboot exist, for reindexing you can use either xquery commands via docker exec
or you can modify the still image before starting the container.
I know these options yes, but I want one Dockerfile to prepare a ready to use image
I guess I'll persist using docker volumes
I m confused now, to start and stop exist from within a Dockerfile
use multiple FROM
, you can prepare indexing operations using RUN
as documented in the readme.
If something isn't working please open a new issue with steps to reproduce, as none of these operations seems to depend on the existence or lack of shell.
I now about those options yes, but find it easier the way I have it now, see: https://bitbucket.org/fryske-akademy/exist-db/src/master/docker/
yup looks good, docker-compose is certainly the elegant solution, also recommended in the readme.
docker exec -it <container> "/bin/bash"
will never work it should be:
docker exec <container> java -jar start.jar client
to talk to exist, or a variation thereof to talk to either jetty or the JVM
to interact with docker instances you can also use node-exist and the cli-tools it exposes.
since there is no sh or bash I cannot interact with a running container which makes docker development very hard