pires / docker-elasticsearch

Dockerfile for a base Elasticsearch image to be extended by others (allow to install plug-ins, change configuration, etc.)
Apache License 2.0
161 stars 173 forks source link

6.2.1 fails with mktemp: Invalid argument #56

Closed rkoc closed 6 years ago

rkoc commented 6 years ago

With ES_VERSION 6.2.1 docker run fails with:

sh: error setting limit: Operation not permitted mktemp: Invalid argument

With ES_VERSION 6.1.3 works

pires commented 6 years ago

@Quentin-M you've been quite active recently so maybe you could help me figure out this one?

Quentin-M commented 6 years ago

@rkoc Hey, could you please provide us the command you are actually running to launch ElasticSearch? Do you use Docker userns remapping by any chance? What's your underlying OS/platform/user?

golonzovsky commented 6 years ago

I have the same issue on both local (Linux 4.13.0-32-generic Ubuntu 17.10) and in k8s cluster (latest stable coreos) based on this template with updated version.

Local run command:

docker run --rm -it --privileged quay.io/pires/docker-elasticsearch:6.2.1
mktemp: Invalid argument
Quentin-M commented 6 years ago

According to my understanding of strace, elasticsearch tries to use mktemp -t <template>. However, Alpine includes the BusyBox version of mktemp, which expects <template> to end with XXXXXX, unlike the GNU version of mktemp. Thus, generating the invalid argument error.

Issue correlates with the following PR: https://github.com/elastic/elasticsearch/pull/27659, introduced in the 6.2.0 release.

Busybox

mktemp --help
BusyBox v1.27.2 (2017-12-12 10:41:50 GMT) multi-call binary.

Usage: mktemp [-dt] [-p DIR] [TEMPLATE]

Create a temporary file with name based on TEMPLATE and print its name.
TEMPLATE must end with XXXXXX (e.g. [/dir/]nameXXXXXX).
Without TEMPLATE, -t tmp.XXXXXX is assumed.

    -d  Make directory, not file
    -q  Fail silently on errors
    -t  Prepend base directory name to TEMPLATE
    -p DIR  Use DIR as a base directory (implies -t)
    -u  Do not create anything; print a name

Base directory is: -p DIR, else $TMPDIR, else /tmp

GNU

Usage: mktemp [OPTION]... [TEMPLATE]
Create a temporary file or directory, safely, and print its name.
TEMPLATE must contain at least 3 consecutive `X's in last component.
If TEMPLATE is not specified, use tmp.XXXXXXXXXX, and --tmpdir is implied.
Files are created u+rw, and directories u+rwx, minus umask restrictions.

  -d, --directory     create a directory, not a file
  -u, --dry-run       do not create anything; merely print a name (unsafe)
  -q, --quiet         suppress diagnostics about file/dir-creation failure
      --suffix=SUFF   append SUFF to TEMPLATE.  SUFF must not contain slash.
                        This option is implied if TEMPLATE does not end in X.
      --tmpdir[=DIR]  interpret TEMPLATE relative to DIR.  If DIR is not
                        specified, use $TMPDIR if set, else /tmp.  With
                        this option, TEMPLATE must not be an absolute name.
                        Unlike with -t, TEMPLATE may contain slashes, but
                        mktemp creates only the final component

  -p DIR              use DIR as a prefix; implies -t [deprecated]
  -t                  interpret TEMPLATE as a single file name component,
                        relative to a directory: $TMPDIR, if set; else the
                        directory specified via -p; else /tmp [deprecated]

      --help     display this help and exit
      --version  output version information and exit

Report mktemp bugs to bug-coreutils@gnu.org
GNU coreutils home page: <http://www.gnu.org/software/coreutils/>
General help using GNU software: <http://www.gnu.org/gethelp/>
Report mktemp translation bugs to <http://translationproject.org/team/>
For complete documentation, run: info coreutils 'mktemp invocation'
Quentin-M commented 6 years ago

Solution is to create the temporary folder ourselves and set the ES_TMPDIR environment variable. I will make a PR in just a few, once I get to the office.

pires commented 6 years ago

Thanks a ton!

ademariag commented 6 years ago

Actual fix is in this MR, I think https://github.com/elastic/elasticsearch/pull/31003

codefromthecrypt commented 6 years ago

@ademariag the issue you mentioned was closed won't fix, so I suppose folks (like us in zipkin) will have to make a one-off fix like others have.