Consul image fail to start in Docker
- Dominant language
- Go
- Stars
- 30.1k
- Forks
- 4.6k
- Avg merge
- 1d 18h
- Merged PRs (30d)
- 39
Description
## Description
When I used Docker to build a Consul cluster, an error occurred when starting the first Consul server agent in cluster mode, and the container has been trying to restart.
And another command can start successfully.
May I ask which parameters caused Consul to fail to start? How should I resolve this?
## Environment
Consul image: hashicorp/consul:1.17.3
Docker version: 24.0.6
Script language: CMD
## The failed startup command I used
``` CMD
docker run -d --name=consul-server-node1 --restart=always ^
-e "CONSUL_LOCAL_CONFIG={"skip_leave_on_interrupt": true}" ^
-p 8300:8300 ^
-p 8301:8301 ^
-p 8302:8302 ^
-p 8500:8500 ^
-p 8600:8600 ^
-h node1 ^
hashicorp/consul:1.17.3 agent -server -ui -bind=0.0.0.0 -node=server-1 -bootstrap-expect=3 -client 0.0.0.0 ^
-data-dir=/tmp/data-dir
```
## The docker container Logs
```
2024-03-30 11:39:46 ==> failed to parse /consul/config/local.json: invalid character 's' looking for beginning of object key string
2024-03-30 11:40:47 ==> failed to parse /consul/config/local.json: invalid character 's' looking for beginning of object key string
```
## Screenshots


## Command that can be successfully launched
```
docker run -d --name=badger --restart=always ^
-p 8500:8500 ^
-p 8600:8600/udp ^
-h node2 ^
hashicorp/consul:1.17.3 agent -server -ui -bind=0.0.0.0 -node=server-1 -bootstrap-expect=3 -client=0.0.0.0 ^
-data-dir=/tmp/data-dir
```
## Screenshots

Contributor guide
Research direction
Reproduce the failed Docker command for hashicorp/consul:1.17.3 and compare its CONSUL_LOCAL_CONFIG argument with the successfully starting command. Start with the container logs showing the /consul/config/local.json parse error; done means identifying the malformed startup parameter and documenting a command that starts successfully.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- docker
- Domain
- infrastructure
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 20/100