hashicorp / hashicorp/consul

Consul image fail to start in Docker

Open
#20,938 0 comments 0 reactions 0 assignees View on GitHub
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
![image](https://github.com/hashicorp/consul/assets/96672802/155d11a7-8d3b-4ce1-8baf-de4ec7e5a99f)
![image](https://github.com/hashicorp/consul/assets/96672802/3f75d3f4-3277-45e6-a92e-762f6c7df6ff)

## 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
![image](https://github.com/hashicorp/consul/assets/96672802/bd4bc5ea-7ef3-4bd2-a0b9-53762fbe1fe4)

Contributor guide

Open the contributing 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.