Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

/var/lib/docker/containers/ does not exist in docker compose bindings in WSL2

I'm trying to host wings inside docker using the official wings docker image. I used docker desktop for my windows installation. I have a modified config below:

services:
  db:
    image: postgres:13
    restart: always
    container_name: corkscrew-db
    environment:
      POSTGRES_USER: user
      POSTGRES_PASSWORD: pass
      POSTGRES_DB: data
    ports:
      - "5432:5432"
  wings:
    image: ghcr.io/pterodactyl/wings:latest
    restart: always
    networks:
      - wings0
    ports:
      - "8080:8080"
      - "2022:2022"
    tty: true
    environment:
      TZ: "UTC"
      WINGS_UID: 988
      WINGS_GID: 988
      WINGS_USERNAME: pterodactyl
    volumes:
      - "/var/run/docker.sock:/var/run/docker.sock"
      - "/var/lib/docker/containers/:/var/lib/docker/containers/" #\\wsl.localhost\docker-desktop-data\data\docker\volumes
      - "./wings/etc/pterodactyl/:/etc/pterodactyl/"
      - "./wings/var/lib/pterodactyl/:/var/lib/pterodactyl/"
      - "./wings/var/log/pterodactyl/:/var/log/pterodactyl/"
      - "./wings/tmp/pterodactyl/:/tmp/pterodactyl/"
      - "./wings/etc/ssl/certs:/etc/ssl/certs:ro"
  web:
    image: node:20.9.0-alpine3.18
    container_name: corkscrew-web
    ports:
      - "5173:5173"
    env_file:
      - .env.dev
    volumes:
      - ./:/app
      - /app/node_modules/
    working_dir: /app
    command: sh -c "yarn && yarn run db:deploy && yarn run seed && yarn run dev --host --port 5173"
    depends_on:
      - db

  
networks:
  wings0:
    name: wings0
    driver: bridge
    ipam:
      config:
        - subnet: "172.21.0.0/16"
    driver_opts:
      com.docker.network.bridge.name: wings0

However, when trying to run it, I encounter an error:

Error response from daemon: invalid mount config for type "bind": bind source path does not exist: /var/lib/pterodactyl/volumes/8f8caa88-7152-46a0-a448-de4168b809e6 

I tried using \\wsl.localhost\docker-desktop-data\data\docker\volumes for my path (this does exist), however, replacing it for my docker volume binding isn't working, and the volumes folder isn't present at all.

like image 321
CoasterFan5 Avatar asked Oct 23 '25 06:10

CoasterFan5


1 Answers

I was looking at the problem all wrong here. Rather than an issue with mounting the docker volumes directory, the issue seemed from this binding: "./wings/var/lib/pterodactyl/:/var/lib/pterodactyl/". Behind the scenes, the docker container uses a linked docker.sock to create a docker container on the host machine; however, during this process, a /var/lib/pterodactyl/ directory was never created on the host machine, meaning it would throw an error. To resolve this, the config can be changed to the following:

services:
  db:
    image: postgres:13
    restart: always
    container_name: corkscrew-db
    environment:
      POSTGRES_USER: user
      POSTGRES_PASSWORD: pass
      POSTGRES_DB: data
    ports:
      - "5432:5432"
  wings:
    image: ghcr.io/pterodactyl/wings:latest
    restart: always
    networks:
      - wings0
    ports:
      - "8080:8080"
      - "2022:2022"
    tty: true
    environment:
      TZ: "UTC"
      WINGS_UID: 988
      WINGS_GID: 988
      WINGS_USERNAME: pterodactyl
    volumes:
      - "/var/run/docker.sock:/var/run/docker.sock"
      - "./var/lib/docker/containers/:/var/lib/docker/containers/" #\\wsl.localhost\docker-desktop-data\data\docker\volumes
      - "./wings/etc/pterodactyl/:/etc/pterodactyl/"
      - "/var/lib/pterodactyl/:/var/lib/pterodactyl/" #changed from "./wings/var/lib/pterodactyl/:/var/lib/pterodactyl/"
      - "./wings/var/log/pterodactyl/:/var/log/pterodactyl/" 
      - "./wings/tmp/pterodactyl/:/tmp/pterodactyl/"
      - "./wings/etc/ssl/certs:/etc/ssl/certs:ro"
  web:
    image: node:20.9.0-alpine3.18
    container_name: corkscrew-web
    ports:
      - "5173:5173"
    env_file:
      - .env.dev
    volumes:
      - ./:/app
      - /app/node_modules/
    working_dir: /app
    command: sh -c "yarn && yarn run db:deploy && yarn run seed && yarn run dev --host --port 5173"
    depends_on:
      - db

  
networks:
  wings0:
    name: wings0
    driver: bridge
    ipam:
      config:
        - subnet: "172.21.0.0/16"
    driver_opts:
      com.docker.network.bridge.name: wings0

This allows the container to create new containers using the docker.sock and create the directory in needs to mount into the new container.

like image 150
CoasterFan5 Avatar answered Oct 26 '25 04:10

CoasterFan5



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!