Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

200
Visualizações
Issue mounting docker volume with docker-compose

My Scenario

I am trying to build docker swarm with docker-compose.yml file

version: '3'

services:
  myapp-nginx:
    image: nginx:1.10
    volumes:
     - ./nginx/certs:/etc/nginx/certs
    ports:
      - 80:80
      - 443:443

using build command as below

$ docker stack deploy --compose-file docker-compose.yml myapp

Creating network myapp_default
Creating service myapp_myapp-nginx

My system have Docker Version 17.03.1-ce-mac5 (16048)

Problem

Volumes mounts are not working, If I comment out volumes: - ./nginx/certs:/etc/nginx/certs then everything works fine.

Otherwise nginx doesn't work at all, I see

CAGTAM1059934:docker iskumar$ docker stack ps myapp
ID            NAME                  IMAGE       NODE      DESIRED STATE  CURRENT STATE            ERROR                             PORTS
efjia8b7y6jd  myapp_myapp-nginx.1      nginx:1.10  manager1  Ready          Rejected 5 seconds ago   "invalid mount config for type…"  
c9c6ogh11osi   \_ myapp_myapp-nginx.1  nginx:1.10  worker2   Shutdown       Rejected 10 seconds ago  "invalid mount config for type…"  
iveikxpnbq6x   \_ myapp_myapp-nginx.1  nginx:1.10  worker1   Shutdown       Rejected 15 seconds ago  "invalid mount config for type…"  

Is there any special way to mount volumes in docker-compose v3?

about 4 years ago · Santiago Trujillo
2 Respostas
Responde à pergunta

0

You must use absolute paths when mounting volumes, also with docker run.

$ docker run --rm -it -v ./eos:/eos:ro ubuntu 
docker: Error response from daemon: create ./eos: "./eos" includes invalid characters for a local volume name, only "[a-zA-Z0-9][a-zA-Z0-9_.-]" are allowed. If you intented to pass a host directory, use absolute path.
See 'docker run --help'
about 4 years ago · Santiago Trujillo Relatório

0

I was running docker stack deploy from my macbook instead on boot2docker VMs. Which is why system couldn't find those network mount source, even though I had manager1 activated using eval $(docker-machine env manager1)

First I used --no-trunc argument to view full error message.

$> docker node ps --no-trunc
---
Showed "invalid mount config for type "bind": bind source path does not exist"  
---

After that copies the files from host system (My MacBook) to VM and launching stack worked fine.

Credit to https://github.com/docker/docker/issues/31202#issuecomment-281312704

about 4 years ago · Santiago Trujillo Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda