hashicorp / hashicorp/consul

Consul cannot access file or directory using docker desktop volume mount

Open
#7,599 0 comments 0 reactions 0 assignees View on GitHub
theme/windows
Dominant language
Go
Stars
30.1k
Forks
4.6k
Avg merge
2d 6h
Merged PRs (30d)
43

Description

Running Consul with docker desktop using windows containers and experimental mode turned on works well. However if I try mounting bitnami consul's datafile to a local volume mount I get the following error:

`chown: cannot access '/bitnami/consul'`

[![powershell chown error][1]][1]

My compose file looks like this:

```yaml
version: "3.7"
services:
consul:
image: bitnami/consul:latest
volumes:
- ${USERPROFILE}\DockerVolumes\consul:/bitnami
ports:
- '8300:8300'
- '8301:8301'
- '8301:8301/udp'
- '8500:8500'
- '8600:8600'
- '8600:8600/udp'
networks:
nat:
aliases:
- consul
```
If I remove the volumes part, everything works just fine, but I cannot persist my data. If followed instructions in the [readme file](https://github.com/bitnami/bitnami-docker-consul#persisting-your-application). The speak of having the proper permissions, but I do not know how to get that to work using docker desktop.

### Running under root user
[As suggested by someone](https://stackoverflow.com/a/61011669/1608705) on stackoverflow, I also tried running under the root user, which actually gave me another error:
`2020-03-30T14:59:00.327Z [ERROR] agent: Error starting agent: error="Failed to start Consul server: Failed to start Raft: invalid argument"`
[![powershell failed to start Raft][2]][2]
The compose file looked like this:
```yaml
version: "3.7"
services:
consul:
image: bitnami/consul:latest
user: root
volumes:
- ${USERPROFILE}\DockerVolumes\consul:/bitnami
ports:
- '8300:8300'
- '8301:8301'
- '8301:8301/udp'
- '8500:8500'
- '8600:8600'
- '8600:8600/udp'
networks:
nat:
aliases:
- consul
```

**Side note**
If I do not mount `/bitnami` but `/bitnami/consul`, I get the following error:
`2020-03-30T14:59:00.327Z [ERROR] agent: Error starting agent: error="Failed to start Consul server: Failed to start Raft: invalid argument"`
[![powershell failed to start Raft][2]][2]

I tried fixing my problem through [stackoverflow](https://stackoverflow.com/q/60933618/1608705), but it didn't help me out.

### Setup
I'm running the latest version of docker desktop (2.2.0.5 (43884) stable) with experimental: true.
![Schermafdruk 2020-03-30 16 35 06](https://user-images.githubusercontent.com/1730868/78473832-e7946e00-7743-11ea-91f6-2cb662115f80.png)

I think this problem is similar to #6430

[1]: https://i.stack.imgur.com/utU94.png
[2]: https://i.stack.imgur.com/sg4C9.png

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.