Skip to content

invalid line return character in docker-entrypoint.sh prevents from using a data volume #35

@Cathbar2

Description

@Cathbar2

Linked to #5 and #6, it would appear that the docker-entrypoint.sh contains an invalid line return, which comments out the "chown" command, and fails the startup.

Test case to reproduce the problem :

  • Host on a Centos 7 machine, with standard docker installation
  • Install docker :
yum install docker
service docker start
docker pull docker.io/elasticsearch
  • create local folder for data and config :
mkdir -p /opt/elasticsearch/data
mkdir -p /opt/elasticsearch/config
docker run --name es -v /opt/elasticsearch/data:/usr/share/elasticsearch/data -v /opt/elasticsearch/config:/usr/share/elasticsearch/config elasticsearch

Note that you will get :

chown: changing ownership of ‘/usr/share/elasticsearch/data’: Permission denied

If you inspect the docker-entrypoint.sh, you will see that the "chown" command is commented out like so :

docker exec -ti es cat /docker-entrypoint.sh

You will get this extract as part of the file :

# Drop root privileges if we are running elasticsearch
if [ "$1" = 'elasticsearch' ]; then
        # Change the ownership of /usr/share/elasticsearch/data to elasticsearch        chown -R elasticsearch:elasticsearch /usr/share/elasticsearch/data
        exec gosu elasticsearch "$@"
fi

Note that the chown is commented out. If you uncomment it on a new line, everything works fine.

Please confirm whether this is a bug.

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