Skip to content

Elasticsearch cannot access data directory under Ubuntu 18.04 #12

@BernhardHH

Description

@BernhardHH

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# 

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions