eXist-db / docker-existdb

Docker image builder for eXist-db
GNU Affero General Public License v3.0
11 stars 6 forks source link

Newbie impressions #28

Closed joewiz closed 6 years ago

joewiz commented 6 years ago

Following the instructions in the README, I hit a roadblock on the line:

docker stop exist

When I ran this after starting the image via the supplied command, I got an error:

$ docker run -it -d -p 8080:8080 -p 8443:8443 existdb/existdb:release
9b875fa2e58ea558ad55fd13bb08bf31baaa3864b5e8ff70974ab5524dbb36d6
$ docker stop exist
Error response from daemon: No such container: exist

Upon further research, I see that when starting docker without a --name flag, docker assigns a random name to the container:

$ docker ps
CONTAINER ID        IMAGE                     COMMAND                  CREATED             STATUS                            PORTS                                            NAMES
9b875fa2e58e        existdb/existdb:release   "java -jar start.jar…"   6 seconds ago       Up 5 seconds (health: starting)   0.0.0.0:8080->8080/tcp, 0.0.0.0:8443->8443/tcp   inspiring_euclid

Here, inspiring_euclid is the container's randomly-generated name. To stop this container you'd need to use this name or the container ID (9b875fa2e58e):

$ docker stop inspiring_euclid
inspiring_euclid

Given this, I think the instructions would generally work if modified to include a --name exist parameter to docker run:

$ docker run -it -d -p 8080:8080 -p 8443:8443 --name exist existdb/existdb:release
a01a78c15fc17804d961052310c41e31e3ac6b14f0b6c732da05b63a37086d22
$ docker ps
CONTAINER ID        IMAGE                     COMMAND                  CREATED             STATUS                            PORTS                                            NAMES
a01a78c15fc1        existdb/existdb:release   "java -jar start.jar…"   2 seconds ago       Up 2 seconds (health: starting)   0.0.0.0:8080->8080/tcp, 0.0.0.0:8443->8443/tcp   exist
$ docker stop exist
exist
$ docker ps -a
CONTAINER ID        IMAGE                     COMMAND                  CREATED             STATUS                        PORTS               NAMES
438fb56ed789        existdb/existdb:release   "java -jar start.jar…"   8 seconds ago       Exited (143) 1 second ago                         exist
$ docker rm exist
exist
$ docker ps -a
CONTAINER ID        IMAGE                     COMMAND                  CREATED             STATUS                        PORTS               NAMES

Next, following the directions in the README under "Development use via docker-compose", I think new users will hit the same thing I did:

$ docker-compose up -d
ERROR: 
        Can't find a suitable configuration file in this directory or any
        parent. Are you in the right directory?

        Supported filenames: docker-compose.yml, docker-compose.yaml

Is the idea that in order to use docker-compose you should first clone the docker-existdb repo, cd into it, and then run this command? If not, what are the assumed setup steps before docker-compose can be run?

Next, the README states that the compose file declares 2 named volumes (exist-data and exist-config), but the docker cp commands refer to exist:eXist. How do the docker cp commands know which volume(s) exist:eXist corresponds to?

Lastly, I'd be grateful for any opinionated links to tutorials for becoming proficient with docker and getting the most out of this image.

duncdrum commented 6 years ago

HI thanks for the input @joewiz, much appreciated, I tried to address your concerns in #29.

If you clone this repo, you ll find a ready to use docker-compose file in it. You don't need to clone the whole repo to use it though, simply copying it is enough.

How do the docker cp commands know which volume(s) exist:eXist corresponds to?

I m not sure i get your question exist:eXist/config/conf.xml =>

We would certainly welcome a PR with a link to a good beginners tutorial about docker, i m afraid I m a bit too much out of the loop to know of any one in particular docker run hello-world used to be a thing. But if you find one that does it for you I d love to hear about it. Is there a specific aspect that you think is missing from the docker docs?

grantmacken commented 6 years ago

If not, what are the assumed setup steps before docker-compose can be run?

Think of docker-compose as being like a package manager like 'npm' or 'yarn' or maybe like a builder like 'ant' or 'Make'. Each of these require a file located in your projects directory root and you invoke the program from the root directory

Likewise docker-compose requires a file docker-compose.yml. The docker-compose.yml in the repo provides good defaults to you get up and running, I would go as far to suggest it is the quickest and easiest way to run eXist. As @duncdrum suggested, copy the the repos docker-compose,yml plus the .env file into your own project directory and invoke docker-compose from within that directory.

grantmacken commented 6 years ago

the README states that the compose file declares 2 named volumes (exist-data and exist-config), but the docker cp commands refer to exist:eXist. How do the docker cp commands know which volume(s) exist:eXist corresponds to?

I think @duncdrum clarified this so I won't add to it.

The functional tests can be seen on travis

# CHECK! the abilty to
#  - alter a config item in a config file on local disk,
#  - copy the altered config file into containers config dir.
#  - stop and start the container
#  - view changed item taking effect in startup logs
#
# The startup log should show altered shutdown time
 - database instance 'exist' will wait  60,000 ms during shutdown 
joewiz commented 6 years ago

@duncdrum @grantmacken Thank you for the clarifications and additional info!