actionml / harness-docker-compose

Repository to store docker-compose files and its dependencies
5 stars 11 forks source link

Elasticsearch cannot access data directory under Ubuntu 18.04 #12

Open BernhardHH opened 4 years ago

BernhardHH commented 4 years ago

When trying the one-line docker-compose version, elasticsearch fails because it cannnot access it's data directory:

elasticsearch    | ElasticsearchException[failed to bind service]; nested: AccessDeniedException[/usr/share/elasticsearch/data/nodes];
elasticsearch    | Likely root cause: java.nio.file.AccessDeniedException: /usr/share/elasticsearch/data/nodes

ES runs in it's docker image not as root, but as user elasticsearch (UID 1000). If you run the docker-compose as root, the docker-persistence directory structure is created for root. If you change ownership of the es directory, elasticsearch will start up fine.

https://github.com/actionml/harness/blob/develop/docker/docker-compose.yml does not have this issue, because the ES data directory is not mapped on the host.

ES version is 7.6.0 Docker Compose is 1.25.5 sudo curl -L "https://github.com/docker/compose/releases/download/1.25.5/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose

Docker install:

sudo apt-get remove docker docker-engine docker.io containerd runc
 sudo apt-get update
 sudo apt-get install apt-transport-https ca-certificates curl gnupg-agent software-properties-common
 curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
 sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"
 sudo apt-get update
 sudo apt-get install docker-ce docker-ce-cli containerd.io

Here is the output of status data:

root@9fa96f3f7e55:/# harness-cli status system
/harness-cli/harness-cli/harness-status: line 10: /harness-cli/harness-cli/RELEASE: No such file or directory
Harness CLI v settings
==================================================================
HARNESS_CLI_HOME ........................ /harness-cli/harness-cli
HARNESS_CLI_SSL_ENABLED .................................... false
HARNESS_CLI_AUTH_ENABLED ................................... false
HARNESS_SERVER_ADDRESS ................................... harness
HARNESS_SERVER_PORT ......................................... 9090
==================================================================
Harness Server status: OK
Harness system info:
{
    "buildVersion": "0.5.2-SNAPSHOT",
    "elasticsearchURI": "http://elasticsearch:9200",
    "gitBranch": "develop",
    "gitHash": "6897758",
    "harnessURI": "http://0.0.0.0:9090",
    "mongoURI": "mongodb://mongo:27017"
}
root@9fa96f3f7e55:/# 

I used the guide at https://actionml.com/docs/harness_container_guide to set up harness.

git clone https://github.com/actionml/harness-docker-compose.git

root@testvm:/var/harness-docker-compose# git status
On branch develop
Your branch is up to date with 'origin/develop'.

Untracked files:
  (use "git add <file>..." to include in what will be committed)

    harness-docker-compose/

nothing added to commit but untracked files present (use "git add" to track)
root@testvm:/var/harness-docker-compose# 
pnutmath commented 3 years ago

Is this issue resolved @BernhardHH ?

asdfMaciej commented 3 years ago

I've encountered exactly the same issue. Running chown 1000:1000 es -R in the docker-persistence directory enabled ES to launch.