Docker-compose vs. running docker from cmd: .sock-problem

When I run my shinyproxy container with the method described here, everything works fine.

Trying to do the same with docker-compose (or, same effect, docker compose swarm) fails with authorization error on docker.sock. The file is set chown root:docker on each docker startup; when I set this to chown dieter:docker, where dieter is the user, all is well, but I have to do this after each docker startup.

I am sure that dieter is in group docker - confirmed by the working command line version. I suspect that group_add in docker-compose is the culprit, it has a bad history of being removed in earlier 3.x versions but is supposed to work now .

Any ideas for a workaround? I must use docker-compose or docker compose because additional containers will be added later.

version: '3.8'
    build: .
    image: shinyproxy-example
    container_name: shinyproxy-ex
      - 8020:8080
      - sp-net
      - docker
      # Check permissions here
      - /var/run/docker.sock:/var/run/docker.sock

  title: Anomanor Shinyproxy
  port: 8080
  authentication: simple
  - name: jack
    password: password
    groups: scientists
  admin-groups: admins
  landing-page: /app_direct/01_hello
      internal-networking: true
  - id: 01_hello
    display-name: Hello Application
    description: Application which demonstrates the basics of a Shiny app
    container-cmd: ["R", "-e", "shinyproxy::run_01_hello()"]
    container-image: openanalytics/shinyproxy-demo
    container-network: sp-net

Even if this merge claims otherwise, group_add does not work in docker-compose, both with number and with name.

Use user: :1001 instead.

Or, better

export DOCKERID=$(getent group docker | cut -d: -f3)
docker compose up --build

and in yml:

    user: ":${DOCKERID}"
1 Like