Answers: <p>You're attempting to create two different containers, each with the same name. Each time you execute <code>docker run</code> it will create a container, and you've named the containers the same with <code>--name basexhttp</code>. These names must be unique, even among stopped containers. To delete an unneeded container, you can stop and remove it with:</p>
  <pre><code>docker container stop basexhttp
  docker container rm basexhttp
  </code></pre>
  <p>(Note that <code>docker stop</code> and <code>docker rm</code> also work, but it's easier to read and understand the more verbose syntax)</p>
  
Answers: CC BY-SA 4.0
Answers: 2020-09-04T12:44:15.573Z
Answers: 2020-09-04T12:44:15.573Z
Answers: BMitch
Body: <p>Am I even correctly <a href="https://devops.stackexchange.com/q/12340/23443">following</a> the documentation on creating and running a docker container below?</p>
  <pre><code>[root@ ~]# 
  [root@ ~]# docker run -d \
  &gt;     --name basexhttp \
  &gt;     --publish 1984:1984 \
  &gt;     --publish 8984:8984 \
  &gt;     --volume &quot;$HOME/basex/data&quot;:/srv/basex/data \
  &gt;     --volume &quot;$HOME/basex/repo&quot;:/srv/basex/repo \
  &gt;     --volume &quot;$HOME/basex/webapp&quot;:/srv/basex/webapp \
  &gt;     basex/basexhttp:latest
  4b827c082bebe45b8be5b7c956f1ada92407181aeec82dc5f71a63f2c5af537e
  [root@ ~]# 
  [root@ ~]# docker run -ti \
  &gt;     --name basexhttp \
  &gt;     --publish 1984:1984 \
  &gt;     --publish 8984:8984 \
  &gt;     --volume &quot;$(pwd)/basex/data&quot;:/srv/basex/data \
  &gt;     basex/basexhttp:latest
  docker: Error response from daemon: Conflict. The container name &quot;/basexhttp&quot; is already in use by container &quot;4b827c082bebe45b8be5b7c956f1ada92407181aeec82dc5f71a63f2c5af537e&quot;. You have to remove (or rename) that container to be able to reuse that name.
  See 'docker run --help'.
  [root@ ~]# 
  [root@ ~]# 
  [root@ ~]# docker container list
  CONTAINER ID        IMAGE               COMMAND             CREATED             STATUS              PORTS               NAMES
  [root@ ~]# 
  [root@ ~]# docker ps
  CONTAINER ID        IMAGE               COMMAND             CREATED             STATUS              PORTS               NAMES
  [root@ ~]# 
  [root@ ~]# docker ps -a
  CONTAINER ID        IMAGE                    COMMAND                  CREATED              STATUS                          PORTS               NAMES
  4b827c082beb        basex/basexhttp:latest   &quot;/usr/local/bin/mvn-…&quot;   About a minute ago   Exited (1) About a minute ago                       basexhttp
  [root@ ~]# 
  </code></pre>
  <p>referencing:</p>
  <p><a href="https://hub.docker.com/r/basex/basexhttp/" rel="nofollow noreferrer">https://hub.docker.com/r/basex/basexhttp/</a></p>
  <p><a href="https://docs.basex.org/index.php?title=Docker&amp;mobileaction=toggle_view_desktop" rel="nofollow noreferrer">https://docs.basex.org/index.php?title=Docker&amp;mobileaction=toggle_view_desktop</a></p>
  <p>where I've copied/pasted what I <strong>think</strong> are the relevant commands.</p>
  
Tags: <docker><containers><databases><bash><images>
Title: docker: Error response from daemon: Conflict. The container name "/basexhttp" is already in use by container
UserDisplayName: Nicholas Saunders
ThreadText: # docker: Error response from daemon: Conflict. The container name "/basexhttp" is already in use by container
  
  (Asked by: username_0 on 2020-09-04)
  
  Am I even correctly [following](https://devops.stackexchange.com/q/12340/23443) the documentation on creating and running a docker container below?
  
  ```
  [root@ ~]# 
  [root@ ~]# 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
  4b827c082bebe45b8be5b7c956f1ada92407181aeec82dc5f71a63f2c5af537e
  [root@ ~]# 
  [root@ ~]# docker run -ti \
  >     --name basexhttp \
  >     --publish 1984:1984 \
  >     --publish 8984:8984 \
  >     --volume "$(pwd)/basex/data":/srv/basex/data \
  >     basex/basexhttp:latest
  docker: Error response from daemon: Conflict. The container name "/basexhttp" is already in use by container "4b827c082bebe45b8be5b7c956f1ada92407181aeec82dc5f71a63f2c5af537e". You have to remove (or rename) that container to be able to reuse that name.
  See 'docker run --help'.
  [root@ ~]# 
  [root@ ~]# 
  [root@ ~]# docker container list
  CONTAINER ID        IMAGE               COMMAND             CREATED             STATUS              PORTS               NAMES
  [root@ ~]# 
  [root@ ~]# docker ps
  CONTAINER ID        IMAGE               COMMAND             CREATED             STATUS              PORTS               NAMES
  [root@ ~]# 
  [root@ ~]# docker ps -a
  CONTAINER ID        IMAGE                    COMMAND                  CREATED              STATUS                          PORTS               NAMES
  4b827c082beb        basex/basexhttp:latest   "/usr/local/bin/mvn-…"   About a minute ago   Exited (1) About a minute ago                       basexhttp
  [root@ ~]# 
  
  ```
  
  referencing:
  
  <https://hub.docker.com/r/basex/basexhttp/>
  
  <https://docs.basex.org/index.php?title=Docker&mobileaction=toggle_view_desktop>
  
  where I've copied/pasted what I **think** are the relevant commands.
  
  **Tags:** docker, containers, databases, bash, images
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2020-09-04. Score: 5 | Accepted answer
  
  You're attempting to create two different containers, each with the same name. Each time you execute `docker run` it will create a container, and you've named the containers the same with `--name basexhttp`. These names must be unique, even among stopped containers. To delete an unneeded container, you can stop and remove it with:
  
  ```
  docker container stop basexhttp
  docker container rm basexhttp
  
  ```
  
  (Note that `docker stop` and `docker rm` also work, but it's easier to read and understand the more verbose syntax)
  
  
  ---
  
  