<p>I'm a bit new to Docker as well, but are you 100% certain that you performed a <a href="https://docs-stage.docker.com/engine/reference/commandline/push/" rel="nofollow noreferrer">Docker push</a> and your commit of your docker image that you're building with composer? And you <a href="https://stackoverflow.com/questions/46321878/how-to-verify-if-the-content-of-two-docker-images-is-exactly-the-same">have matching versions on the remote and your local machine</a>?</p>
<p>I'm also not seeing where you are mounting the '~/.guacamole/lib' path in your docker-compose.yml under <code>volumes:</code></p>

CC BY-SA 4.0
2020-09-08T10:41:03.980Z
My understanding is that no push is necessary (assuming this pushes the image to dockerhub). I am not using a mounted volume but adding a file to /root/.guacamole/lib then committing to create an image which includes this file. You can see this has succeeded in the docker run part of the terminal listing above, which runs a container based on the new image including the additional file. The same does not happen when a container based on the same image is initiated via docker-compose. What have I missed/misunderstood?
Gareth
CC BY-SA 4.0
2020-09-07T16:26:51.900Z
2020-09-07T16:26:51.900Z
CoolElectricity
<p>I have just started exploring Docker and am having trouble with docker commit/-compose.</p>
<p>I have copied a file into /root/.guacamole/lib (in the container) and then created an image using docker commit.</p>
<p>An <code>ls</code> of the relevant path in the container using</p>
<pre><code>docker run -it --name=&quot;name&quot; image bash
</code></pre>
<p>confirms that the file exists, but when the following docker-compose file sets up the container, the file is missing, even though it reports using the same image.</p>
<p>Any idea why that should be?</p>
<p>Thanks</p>
<pre><code>$ cat docker-compose.yml
version: &quot;2&quot;
services:
  guacd:
    image: &quot;guacamole/guacd&quot;
    container_name: guacd
    hostname: guacd
    restart: always
    volumes:
      - &quot;/data/shared/guacamole/guacd/data:/data&quot;
      - &quot;/data/shared/guacamole/guacd/conf:/conf:ro&quot;
    expose:
      - &quot;4822&quot;
    ports:
      - &quot;4822:4822&quot;
    network_mode: bridge

  guac2:
    image: &quot;guac2&quot;
    container_name: guac2
    hostname: guac2
    restart: always
    volumes:
      - &quot;/data/shared/guacamole/guacamole/guac-home:/data&quot;
      - &quot;/data/shared/guacamole/guacamole/conf:/conf:ro&quot;
    expose:
      - &quot;8080&quot;
    ports:
      - &quot;8084:8080&quot;
    network_mode: bridge
    environment:
      - &quot;GUACD_HOSTNAME=pc.lan&quot;
      - &quot;GUACD_PORT=4822&quot;
      - &quot;MYSQL_HOSTNAME=pc.lan&quot;
      - &quot;MYSQL_PORT=3306&quot;
      - &quot;MYSQL_DATABASE=guacamole_db&quot;
      - &quot;MYSQL_USER=guacamole_user&quot;
      - &quot;MYSQL_PASSWORD=password&quot;
      - &quot;GUACAMOLE_HOME=/data&quot;
</code></pre>
<p>Here is the terminal text:</p>
<pre><code>user@pc:~$ docker run -it --name=&quot;test&quot; guac2 bash
root@b6dcd7dda985:/opt/guacamole# cd /root/.g*/lib
root@b6dcd7dda985:~/.guacamole/lib# ls
mariadb-java-client-2.6.2.jar  mysql-connector-java-5.1.46-bin.jar  mysql-connector-java-5.1.46.jar
***[NB 3 files listed above]***
root@b6dcd7dda985:~/.guacamole/lib# exit
exit
user@pc:~$ docker stop test
test
user@pc:~$ docker rm test
test
user@pc:~$ docker ps -a
CONTAINER ID        IMAGE               COMMAND                  CREATED             STATUS              PORTS                    NAMES
ea92c2db77f6        guac2               &quot;/opt/guacamole/bin/…&quot;   51 minutes ago      Up 51 minutes       0.0.0.0:8084-&gt;8080/tcp   guac2
52aea98f7e2c        guacamole/guacd     &quot;/bin/sh -c '/usr/lo…&quot;   About an hour ago   Up 57 minutes       0.0.0.0:4822-&gt;4822/tcp   guacd
user@pc:~$ docker stop guacd
guacd
user@pc:~$ docker stop guac2
guac2
user@pc:~$ docker rm guacd
guacd
user@pc:~$ docker rm guac2
guac2
user@pc:~$ docker-compose up -d
Creating guac2 ... done
Creating guacd ... done
user@pc:~$ docker exec -it guac2 bash
root@guac2:/opt/guacamole# cd /root/.g*/lib
root@guac2:~/.guacamole/lib# ls
mysql-connector-java-5.1.46-bin.jar  mysql-connector-java-5.1.46.jar
***[NB only 2 files listed above]***
root@guac2:~/.guacamole/lib# exit
</code></pre>

<docker><docker-compose>
docker run vs docker-compose - different results?
Gareth
# docker run vs docker-compose - different results?

(Asked by: username_0 on 2020-09-06)

I have just started exploring Docker and am having trouble with docker commit/-compose.
I have copied a file into /root/.guacamole/lib (in the container) and then created an image using docker commit.
An ls of the relevant path in the container using
docker run -it --name="name" image bash

confirms that the file exists, but when the following docker-compose file sets up the container, the file is missing, even though it reports using the same image.
Any idea why that should be?
Thanks
$ cat docker-compose.yml
version: "2"
services:
  guacd:
    image: "guacamole/guacd"
    container_name: guacd
    hostname: guacd
    restart: always
    volumes:
      - "/data/shared/guacamole/guacd/data:/data"
      - "/data/shared/guacamole/guacd/conf:/conf:ro"
    expose:
      - "4822"
    ports:
      - "4822:4822"
    network_mode: bridge

  guac2:
    image: "guac2"
    container_name: guac2
    hostname: guac2
    restart: always
    volumes:
      - "/data/shared/guacamole/guacamole/guac-home:/data"
      - "/data/shared/guacamole/guacamole/conf:/conf:ro"
    expose:
      - "8080"
    ports:
      - "8084:8080"
    network_mode: bridge
    environment:
      - "GUACD_HOSTNAME=pc.lan"
      - "GUACD_PORT=4822"
      - "MYSQL_HOSTNAME=pc.lan"
      - "MYSQL_PORT=3306"
      - "MYSQL_DATABASE=guacamole_db"
      - "MYSQL_USER=guacamole_user"
      - "MYSQL_PASSWORD=password"
      - "GUACAMOLE_HOME=/data"

Here is the terminal text:
user@pc:~$ docker run -it --name="test" guac2 bash
root@b6dcd7dda985:/opt/guacamole# cd /root/.g*/lib
root@b6dcd7dda985:~/.guacamole/lib# ls
mariadb-java-client-2.6.2.jar  mysql-connector-java-5.1.46-bin.jar  mysql-connector-java-5.1.46.jar
***[NB 3 files listed above]***
root@b6dcd7dda985:~/.guacamole/lib# exit
exit
user@pc:~$ docker stop test
test
user@pc:~$ docker rm test
test
user@pc:~$ docker ps -a
CONTAINER ID        IMAGE               COMMAND                  CREATED             STATUS              PORTS                    NAMES
ea92c2db77f6        guac2               "/opt/guacamole/bin/…"   51 minutes ago      Up 51 minutes       0.0.0.0:8084->8080/tcp   guac2
52aea98f7e2c        guacamole/guacd     "/bin/sh -c '/usr/lo…"   About an hour ago   Up 57 minutes       0.0.0.0:4822->4822/tcp   guacd
user@pc:~$ docker stop guacd
guacd
user@pc:~$ docker stop guac2
guac2
user@pc:~$ docker rm guacd
guacd
user@pc:~$ docker rm guac2
guac2
user@pc:~$ docker-compose up -d
Creating guac2 ... done
Creating guacd ... done
user@pc:~$ docker exec -it guac2 bash
root@guac2:/opt/guacamole# cd /root/.g*/lib
root@guac2:~/.guacamole/lib# ls
mysql-connector-java-5.1.46-bin.jar  mysql-connector-java-5.1.46.jar
***[NB only 2 files listed above]***
root@guac2:~/.guacamole/lib# exit

**Tags:** docker, docker-compose


---

## 1 answers

### Answer by username_1 on 2020-09-07. Score: 1

I'm a bit new to Docker as well, but are you 100% certain that you performed a [Docker push](https://docs-stage.docker.com/engine/reference/commandline/push/) and your commit of your docker image that you're building with composer? And you [have matching versions on the remote and your local machine](https://stackoverflow.com/questions/46321878/how-to-verify-if-the-content-of-two-docker-images-is-exactly-the-same)?

I'm also not seeing where you are mounting the '~/.guacamole/lib' path in your docker-compose.yml under `volumes:`

> **Comments:**
> **username_0**: My understanding is that no push is necessary (assuming this pushes the image to dockerhub). I am not using a mounted volume but adding a file to /root/.guacamole/lib then committing to create an image which includes this file. You can see this has succeeded in the docker run part of the terminal listing above, which runs a container based on the new image including the additional file. The same does not happen when a container based on the same image is initiated via docker-compose. What have I missed/misunderstood?  

---

