0

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

1 Answer 1

1

I'm a bit new to Docker as well, but are you 100% certain that you performed a Docker 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?

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

1
  • 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
    Sep 8, 2020 at 10:41

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.