Answers: <p>Whoever created <code>basex/basexhttp:latest</code> does not seem to know Docker very well. They copied files necessary to a directory that was later configured as a volume, <strong>which means it can only be bound to an anonymous volume, otherwise files inside will be removed</strong>. They left source code inside the image, they used a single stage build with <code>maven:3-jdk-8-alpine</code> as base image, which means the final image has many unnecesary things installed. They left the entrypoint from the base image intact, which I guess is why they needed to create an empty <code>/srv/.m2</code> directory and set it as Maven config dir for the image to start. It switches user from <code>root</code> to <code>basex</code>, which causes permission problems with bind mounts. Generally it's a mess.</p>
  <p>I see two ways to successfully run this image:</p>
  <p>First:</p>
  <pre><code>docker run -d \
      --name basexhttp \
      --publish 1984:1984 \
      --publish 8984:8984 \
      --entrypoint &quot;&quot; \
      basex/basexhttp:latest /usr/local/bin/basexhttp 
  </code></pre>
  <p>This uses only anonymous volumes and clears that unnecessary entrypoint.</p>
  <p>You can stop it with <code>docker stop basexhttp</code> and then remove it with <code>docker rm -v basexhttp</code>. That <code>-v</code> is important - it removes the volumes - unless you memorize their very long IDs and which was mounted which you won't be able to reuse them anyway, so you may as well remove them from your system.</p>
  <p>Second:</p>
  <pre><code>mkdir -p $HOME/basex/data
  mkdir -p $HOME/basex/repo
  mkdir -p $HOME/basex/webapp
  chmod a+w basex
  sudo chown -R 1984:1984 $HOME/basex
  docker run -d \
      --name basexhttp \
      --publish 1984:1984 \
      --publish 8984:8984 \
      --volume &quot;$HOME/basex/data&quot;:/srv/basex/data \
      --volume &quot;$HOME/basex/repo&quot;:/srv/basex/repo \
      --volume &quot;$HOME/basex/webapp&quot;:/srv/basex/webapp \
      --entrypoint &quot;&quot; \
      basex/basexhttp:latest bash -c &quot;cp -r /usr/src/basex/basex-api/src/main/webapp/WEB-INF /srv/basex/webapp &amp;&amp; exec /usr/local/bin/basexhttp&quot;
  </code></pre>
  <p>This creates the necessary directories and sets their permissions so that both your user on the host and user.</p>
  <p>You can stop it as in the previous example and remove with <code>docker rm basexhttp</code>. This time <code>-v</code> is not necessary, as there are no anonymous volumes.</p>
  <p>You can verify that the contaienr is running correctly by executing:</p>
  <pre><code>docker exec -ti basexhttp basexclient
  </code></pre>
  <p>Username and password are both admin.</p>
  
Answers: CC BY-SA 4.0
Answers: 2020-09-05T00:24:04.603Z
Answers: I passed on your remarks to the mailing list for `BaseX`; thanks.
Answers: Nicholas Saunders
Answers: CC BY-SA 4.0
Answers: 2020-09-04T20:40:32.733Z
Answers: 2020-09-04T20:40:32.733Z
Answers: Konrad Botor
Body: <p>A basic <code>jetty</code> container:</p>
  <pre><code>CONTAINER ID        IMAGE               COMMAND                  CREATED             STATUS              PORTS                                                  NAMES
  7c10b0ca16bd        jetty               &quot;/docker-entrypoint.…&quot;   21 seconds ago      Up 18 seconds       8080/tcp, 0.0.0.0:80-&gt;800/tcp, 0.0.0.0:443-&gt;8443/tcp   jetty01
  </code></pre>
  <p>can easily get a <code>bash</code> terminal as:</p>
  <pre><code>docker exec -ti jetty01 bash
  </code></pre>
  <p>created as so:</p>
  <pre><code>docker run -d \
      --name jetty01 \
      -d \
      -p 80:800 \
      -p 443:8443 \
      jetty
  </code></pre>
  <p>but, this approach fails with the <code>basex</code> from docker <a href="https://hub.docker.com/r/basex/basexhttp/" rel="nofollow noreferrer">hub</a>:</p>
  <pre><code>docker exec -ti basexhttp bash
  Error response from daemon: Container 52b5337d7e6a22964310afb0be5f79ace38993173218fae8d9dcd858e4681142 is not running
  </code></pre>
  <p>created as:</p>
  <pre><code>docker run -d \
      --name basexhttp \
      --publish 1984:1984 \
      --publish 8984:8984 \
      --volume &quot;$HOME/basex/data&quot;:/srv/basex/data \
      --volume &quot;$HOME/basex/repo&quot;:/srv/basex/repo \
      --volume &quot;$HOME/basex/webapp&quot;:/srv/basex/webapp \
      basex/basexhttp:latest
  </code></pre>
  <p>How do I get a root bash terminal?</p>
  <p>How do I start the <code>basex</code> container? I tried:</p>
  <pre><code>docker start 52b5337d7e6a22964310afb0be5f79ace38993173218fae8d9dcd858e4681142
  </code></pre>
  <p>still nothing listed.  But, <code>docker ps -a</code> shows:</p>
  <pre><code>CONTAINER ID        IMAGE                    COMMAND                  CREATED             STATUS                     PORTS               NAMES
  52b5337d7e6a        basex/basexhttp:latest   &quot;/usr/local/bin/mvn-…&quot;   10 minutes ago      Exited (1) 2 minutes ago                       basexhttp
  </code></pre>
  <p>although it doesn't show in <code>docker ps</code> because it's not running.</p>
  
Comments: CC BY-SA 4.0
Comments: 2020-09-03T12:33:53.053Z
Comments: when i ran this locally, it looked like a problem with the a missing file: `/srv/src/main/webapp/WEB-INF/web.xml not found`. Obtained using `docker logs basexhttp`
Comments: Bruce Becker
Comments: CC BY-SA 4.0
Comments: 2020-09-03T14:33:24.517Z
Comments: thanks @BruceBecker but how are you adding the file into the container if it won't start?  Or, are you starting it in some other way, then adding the file, perhaps?
Comments: Nicholas Saunders
Comments: CC BY-SA 4.0
Comments: 2020-09-04T19:34:08.480Z
Comments: Maybe try image with different tag? Eg. basex/basexhttp:9.4.2.
Comments: Konrad Botor
Tags: <docker><containers><databases><bash><images>
Title: cannot get bash prompt: Error response from daemon: Container foo is not running
UserDisplayName: Nicholas Saunders
ThreadText: # cannot get bash prompt: Error response from daemon: Container foo is not running
  
  (Asked by: username_0 on 2020-09-03)
  
  A basic `jetty` container:
  
  ```
  CONTAINER ID        IMAGE               COMMAND                  CREATED             STATUS              PORTS                                                  NAMES
  7c10b0ca16bd        jetty               "/docker-entrypoint.…"   21 seconds ago      Up 18 seconds       8080/tcp, 0.0.0.0:80->800/tcp, 0.0.0.0:443->8443/tcp   jetty01
  
  ```
  
  can easily get a `bash` terminal as:
  
  ```
  docker exec -ti jetty01 bash
  
  ```
  
  created as so:
  
  ```
  docker run -d \
      --name jetty01 \
      -d \
      -p 80:800 \
      -p 443:8443 \
      jetty
  
  ```
  
  but, this approach fails with the `basex` from docker [hub](https://hub.docker.com/r/basex/basexhttp/):
  
  ```
  docker exec -ti basexhttp bash
  Error response from daemon: Container 52b5337d7e6a22964310afb0be5f79ace38993173218fae8d9dcd858e4681142 is not running
  
  ```
  
  created as:
  
  ```
  docker run -d \
      --name basexhttp \
      --publish 1984:1984 \
      --publish 8984:8984 \
      --volume "$HOME/basex/data":/srv/basex/data \
      --volume "$HOME/basex/repo":/srv/basex/repo \
      --volume "$HOME/basex/webapp":/srv/basex/webapp \
      basex/basexhttp:latest
  
  ```
  
  How do I get a root bash terminal?
  
  How do I start the `basex` container? I tried:
  
  ```
  docker start 52b5337d7e6a22964310afb0be5f79ace38993173218fae8d9dcd858e4681142
  
  ```
  
  still nothing listed. But, `docker ps -a` shows:
  
  ```
  CONTAINER ID        IMAGE                    COMMAND                  CREATED             STATUS                     PORTS               NAMES
  52b5337d7e6a        basex/basexhttp:latest   "/usr/local/bin/mvn-…"   10 minutes ago      Exited (1) 2 minutes ago                       basexhttp
  
  ```
  
  although it doesn't show in `docker ps` because it's not running.
  
  **Tags:** docker, containers, databases, bash, images
  
  > **Comments:**
  > **username_1**: when i ran this locally, it looked like a problem with the a missing file: `/srv/src/main/webapp/WEB-INF/web.xml not found`. Obtained using `docker logs basexhttp`  
  > **username_0**: thanks @username_1 but how are you adding the file into the container if it won't start?  Or, are you starting it in some other way, then adding the file, perhaps?  
  > **username_2**: Maybe try image with different tag? Eg. basex/basexhttp:9.4.2.  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_2 on 2020-09-04. Score: 2 | Accepted answer
  
  Whoever created `basex/basexhttp:latest` does not seem to know Docker very well. They copied files necessary to a directory that was later configured as a volume, **which means it can only be bound to an anonymous volume, otherwise files inside will be removed**. They left source code inside the image, they used a single stage build with `maven:3-jdk-8-alpine` as base image, which means the final image has many unnecesary things installed. They left the entrypoint from the base image intact, which I guess is why they needed to create an empty `/srv/.m2` directory and set it as Maven config dir for the image to start. It switches user from `root` to `basex`, which causes permission problems with bind mounts. Generally it's a mess.
  
  I see two ways to successfully run this image:
  
  First:
  
  ```
  docker run -d \
      --name basexhttp \
      --publish 1984:1984 \
      --publish 8984:8984 \
      --entrypoint "" \
      basex/basexhttp:latest /usr/local/bin/basexhttp 
  
  ```
  
  This uses only anonymous volumes and clears that unnecessary entrypoint.
  
  You can stop it with `docker stop basexhttp` and then remove it with `docker rm -v basexhttp`. That `-v` is important - it removes the volumes - unless you memorize their very long IDs and which was mounted which you won't be able to reuse them anyway, so you may as well remove them from your system.
  
  Second:
  
  ```
  mkdir -p $HOME/basex/data
  mkdir -p $HOME/basex/repo
  mkdir -p $HOME/basex/webapp
  chmod a+w basex
  sudo chown -R 1984:1984 $HOME/basex
  docker run -d \
      --name basexhttp \
      --publish 1984:1984 \
      --publish 8984:8984 \
      --volume "$HOME/basex/data":/srv/basex/data \
      --volume "$HOME/basex/repo":/srv/basex/repo \
      --volume "$HOME/basex/webapp":/srv/basex/webapp \
      --entrypoint "" \
      basex/basexhttp:latest bash -c "cp -r /usr/src/basex/basex-api/src/main/webapp/WEB-INF /srv/basex/webapp && exec /usr/local/bin/basexhttp"
  
  ```
  
  This creates the necessary directories and sets their permissions so that both your user on the host and user.
  
  You can stop it as in the previous example and remove with `docker rm basexhttp`. This time `-v` is not necessary, as there are no anonymous volumes.
  
  You can verify that the contaienr is running correctly by executing:
  
  ```
  docker exec -ti basexhttp basexclient
  
  ```
  
  Username and password are both admin.
  
  > **Comments:**
  > **username_0**: I passed on your remarks to the mailing list for `BaseX`; thanks.  
  
  ---
  
  