Docker Community Forums

Share and learn in the Docker community.

Unplaced volume in the config docker-compose

Trying to deploy a container, I get an error related to an absolute path.

docker version 20.10.8, build 3967b7d
docker-compose version 1.29.2, build 5becea4c

There is no such path in the * .yml file, I can’t imagine how it appeared in the config.

ERROR: for %name_object% Cannot create container for service %name_object%: invalid volume specification: ‘.:.:rw’: invalid mount config for type “volume”: invalid mount path: ‘.’ mount path must be absolute
ERROR: Encountered errors while bringing up the project.

This is what a * .yml file looks like:

version: '3'
services:
  %name_object%:
    image: %image_name%:latest
    container_name: %container_name%
    environment:
      - SSH_AUTH_SOCK
      - HOME=/var/www
      - WAIT_HOSTS=%host_name:port%, %host_name:port%
    command: install
    volumes:
      - ./:/var/www/html/
      - /etc/passwd:/etc/passwd:ro
      - /etc/group:/etc/group:ro
      - ${SSH_AUTH_SOCK}:${SSH_AUTH_SOCK}
      - /var/log/wb/:/var/log/wb/
    user: ${UID}:${UID}
    restart: on-failure
    networks:
      - wb-net

At the same time, the output of the config shows this (./dev config):

services:
  %name_object%:
    command: install
    container_name: %container_name%
    environment:
      HOME: /var/www
      SSH_AUTH_SOCK: null
      WAIT_HOSTS: %host_name:port%, %host_name:port%
    image: %image_name%:latest
    networks:
      wb-net: {}
    restart: on-failure
    user: 1000:1000
    volumes:
    - .:.:rw
    - /etc/group:/etc/group:ro
    - /etc/passwd:/etc/passwd:ro
    - /var/log/wb:/var/log/wb:rw
    - /home/administrator/wb-voc:/var/www/html:rw

The problem is reproducible on clean ubuntu 20 lts and on ubuntu under windows using WSL 2.
Please tell me workarounds on how to avoid such a problem. I would be glad if someone shares their experience who faced this problem.

Didn’t you get any warning about $SSH_AUTH_SOCK not being set?

I’d guess here is your problem:

environment:
  HOME: /var/www
  SSH_AUTH_SOCK: null
  ...

…along with:

volumes:
  - ...
  - ${SSH_AUTH_SOCK}:${SSH_AUTH_SOCK}