Docker image seemingly having missing layers - macos
I'm experiencing some apparent strange behaviour with a docker build, resulting in the image missing some binaries. It almost seems as if some layers are actually missing from the image.
The hierarchy is thus:
java:8
|
-> localhost:5000/php-cli-wiremock
|
-> localhost:5000/php-cli-wiremock-postgres
Containers ran from "php-cli-wiremock" have all the expected binaries (java, php-cli, wiremock)
Containers ran from "php-cli-wiremock-postgres" only have (php-cli, wiremock, postgres). i.e. they lack the /usr/bin/java. It would almost appear as if the java:8 layers are dropped, yet they appear in the docker history as shown below.
I am confident that these binaries aren't deleted in any steps of the "php-cli-wiremock-postgres" build.
Building the images
**"java:8" Dockerfile: **
https://github.com/docker-library/openjdk/blob/baaaf7714f9c66e4c5decf2c108a2738b7186c7f/8-jre/Dockerfile
"php-cli-wiremock" Dockerfile:
# combination of wiremock and php-cli. Combination is necessary to allow use with shippable.com
FROM java:8
# ----- wiremock ----
ENV WM_PKG_NAME wiremock
ENV WM_VERSION 1.57
# ----- php-cli ----
ENV PHP_VERSION 5.6.24
ENV PHP_INI_DIR /usr/local/etc/php
ENV PHP_BUILD_DEPS bzip2 \
file \
libbz2-dev \
libcurl4-openssl-dev \
libjpeg-dev \
libmcrypt-dev \
libpng12-dev \
libreadline6-dev \
libssl-dev \
libxslt1-dev \
libxml2-dev \
libreadline-dev \
libncursesw5-dev \
libnewt-dev
# ----- wiremock ----
RUN \
cd / && \
wget https://repo1.maven.org/maven2/com/github/tomakehurst/wiremock/$WM_VERSION/$WM_PKG_NAME-$WM_VERSION-standalone.jar && \
mkdir /$WM_PKG_NAME && mv $WM_PKG_NAME-$WM_VERSION-standalone.jar /$WM_PKG_NAME/$WM_PKG_NAME.jar
# ----- php-cli ----
RUN apt-get update && apt-get install -y ca-certificates curl libxml2 autoconf \
gcc libc-dev make pkg-config nano less tmux wget git postgresql libpq-dev \
$PHP_BUILD_DEPS $PHP_EXTRA_BUILD_DEPS \
--no-install-recommends && rm -r /var/lib/apt/lists/*
RUN gpg --keyserver pool.sks-keyservers.net --recv-keys 6E4F6AB321FDC07F2C332E3AC2BF0BC433CFC8B3 0BD78B5F97500D450838F95DFE857D9A90D90EC1 \
&& mkdir -p $PHP_INI_DIR/conf.d \
&& set -x \
&& curl -SL "http://php.net/get/php-$PHP_VERSION.tar.bz2/from/this/mirror" -o php.tar.bz2 \
&& curl -SL "http://php.net/get/php-$PHP_VERSION.tar.bz2.asc/from/this/mirror" -o php.tar.bz2.asc \
&& gpg --verify php.tar.bz2.asc \
&& mkdir -p /usr/src/php \
&& tar -xof php.tar.bz2 -C /usr/src/php --strip-components=1 \
&& rm php.tar.bz2* \
&& cd /usr/src/php \
&& ./configure \
--with-pdo-pgsql=/Applications/Postgres.app/Contents/Versions/9.5/bin \
--with-config-file-path="$PHP_INI_DIR" \
--with-config-file-scan-dir="$PHP_INI_DIR/conf.d" \
$PHP_EXTRA_CONFIGURE_ARGS \
--disable-cgi \
--enable-bcmath \
--with-bz2 \
--enable-calendar \
--with-curl \
--with-gd \
--with-jpeg-dir \
--enable-gd-native-ttf \
--enable-mbstring \
--with-mcrypt \
--enable-pcntl \
--with-openssl \
--with-xsl \
--with-readline \
--with-zlib \
--enable-zip \
--with-newt \
&& make -j"$(nproc)" \
&& make install \
&& { find /usr/local/bin /usr/local/sbin -type f -executable -exec strip --strip-all '{}' + || true; } \
&& apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false -o APT::AutoRemove::SuggestsImportant=false $buildDeps \
&& make clean \
&& pecl install ncurses \
&& pecl install newt \
&& cd /opt \
&& curl -sS https://getcomposer.org/installer | php \
&& ln -s /opt/composer.phar /usr/local/bin/composer \
&& wget https://phar.phpunit.de/phpunit.phar \
&& chmod +x phpunit.phar \
&& mv phpunit.phar /usr/local/bin/phpunit
RUN groupadd -r app -g 433 && \
mkdir /home/app && \
useradd -u 431 -r -g app -d /home/app -s /bin/sh -c "Default application account" app && \
chown -R app:app /home/app && \
chmod 711 /home/app
# ----- shippable.com ----
RUN apt-get update && apt-get -qq -y install curl lsb-release && \
echo $(lsb_release -c -s) && \
export CLOUD_SDK_REPO="cloud-sdk-$(lsb_release -c -s)" && \
echo $CLOUD_SDK_REPO && \
# export CLOUD_SDK_REPO="cloud-sdk-jessie" && \
echo "deb http://packages.cloud.google.com/apt $CLOUD_SDK_REPO main" | tee /etc/apt/sources.list.d/google-cloud-sdk.list && \
curl https://packages.cloud.google.com/apt/doc/apt-key.gpg | apt-key add - && \
apt-get update && \
apt-get -qq -y install google-cloud-sdk
# ----- php-cli ----
COPY files /
ADD php.ini /usr/local/etc/php/php.ini
COPY ./docker-entrypoint.sh /
# ----- wiremock ----
COPY wiremockCacheFiles/__files /wiremock/__files
COPY wiremockCacheFiles/mappings /wiremock/mappings
#VOLUME ["/wiremock/__files", "/wiremock/mappings"]
#WORKDIR /opt/app
# Define default command.
ENTRYPOINT ["/docker-entrypoint.sh"]
#ENTRYPOINT exec java -jar wiremock.jar
# ENTRYPOINT pwd && ls -la
# Expose ports.
# - 8080: HTTP
EXPOSE 8080
"php-cli-wiremock-postgres" Dockerfile:
# combination of wiremock and php-cli and postgres. Combination is necessary to allow use with shippable.com
FROM localhost:5000/php-cli-wiremock:latest
# explicitly set user/group IDs
#RUN groupadd -r postgres --gid=999 && useradd -r -g postgres --uid=999 postgres
# grab gosu for easy step-down from root
ENV GOSU_VERSION 1.7
RUN set -x \
&& apt-get update && apt-get install -y --no-install-recommends ca-certificates wget && rm -rf /var/lib/apt/lists/* \
&& wget -O /usr/local/bin/gosu "https://github.com/tianon/gosu/releases/download/$GOSU_VERSION/gosu-$(dpkg --print-architecture)" \
&& wget -O /usr/local/bin/gosu.asc "https://github.com/tianon/gosu/releases/download/$GOSU_VERSION/gosu-$(dpkg --print-architecture).asc" \
&& export GNUPGHOME="$(mktemp -d)" \
&& gpg --keyserver ha.pool.sks-keyservers.net --recv-keys B42F6819007F00F88E364FD4036A9C25BF357DD4 \
&& gpg --batch --verify /usr/local/bin/gosu.asc /usr/local/bin/gosu \
&& rm -r "$GNUPGHOME" /usr/local/bin/gosu.asc \
&& chmod +x /usr/local/bin/gosu \
&& gosu nobody true \
&& apt-get purge -y --auto-remove ca-certificates wget
# make the "en_US.UTF-8" locale so postgres will be utf-8 enabled by default
RUN apt-get update && apt-get install -y locales && rm -rf /var/lib/apt/lists/* \
&& localedef -i en_US -c -f UTF-8 -A /usr/share/locale/locale.alias en_US.UTF-8
ENV LANG en_US.utf8
RUN mkdir /docker-entrypoint-initdb.d
RUN apt-key adv --keyserver ha.pool.sks-keyservers.net --recv-keys B97B0AFCAA1A47F044F244A07FCC7D46ACCC4CF8
ENV PG_MAJOR 9.5
ENV PG_VERSION 9.5.4-1.pgdg80+1
RUN echo 'deb http://apt.postgresql.org/pub/repos/apt/ jessie-pgdg main' $PG_MAJOR > /etc/apt/sources.list.d/pgdg.list
RUN apt-get update \
&& apt-get install -y postgresql-common \
&& sed -ri 's/#(create_main_cluster) .*$/\1 = false/' /etc/postgresql-common/createcluster.conf \
&& apt-get install -y \
postgresql-$PG_MAJOR=$PG_VERSION \
postgresql-contrib-$PG_MAJOR=$PG_VERSION \
&& rm -rf /var/lib/apt/lists/*
# make the sample config easier to munge (and "correct by default")
RUN mv -v /usr/share/postgresql/$PG_MAJOR/postgresql.conf.sample /usr/share/postgresql/ \
&& ln -sv ../postgresql.conf.sample /usr/share/postgresql/$PG_MAJOR/ \
&& sed -ri "s!^#?(listen_addresses)\s*=\s*\S+.*!\1 = '*'!" /usr/share/postgresql/postgresql.conf.sample
RUN mkdir -p /var/run/postgresql && chown -R postgres /var/run/postgresql
ENV PATH /usr/lib/postgresql/$PG_MAJOR/bin:$PATH
ENV PGDATA /var/lib/postgresql/data
#VOLUME /var/lib/postgresql/data
#ADD postgresql.conf /var/lib/postgresql/data/postgresql
ADD postgresql.conf /postgresql.conf
COPY initdb.sh /
COPY docker-entrypoint.sh /
ENTRYPOINT ["/docker-entrypoint.sh"]
EXPOSE 5432
#CMD ["postgres"]
Output of docker history localhost:5000/php-cli-wiremock-postgres:latest:
IMAGE CREATED CREATED BY SIZE COMMENT
b6243b6f44fc About an hour ago /bin/sh -c #(nop) EXPOSE 5432/tcp 0 B
cb7b81da3181 About an hour ago /bin/sh -c #(nop) ENTRYPOINT ["/docker-entry 0 B
b6b3fd7e0e82 About an hour ago /bin/sh -c #(nop) COPY file:26fb846861d8cff95 97 B
e6cbbd72e89a 3 hours ago /bin/sh -c #(nop) COPY file:d243227d56acbcd72 2.585 kB
5e382c77c42b 3 hours ago /bin/sh -c #(nop) ADD file:7b8d8ca4cd55918f07 20.35 kB
863f87e01e58 13 hours ago /bin/sh -c #(nop) ENV PGDATA=/var/lib/postgr 0 B
82802fc4c604 13 hours ago /bin/sh -c #(nop) ENV PATH=/usr/lib/postgres 0 B
7e9e650a6cb7 13 hours ago /bin/sh -c mkdir -p /var/run/postgresql && ch 0 B
abebf727dda1 13 hours ago /bin/sh -c mv -v /usr/share/postgresql/$PG_MA 21.2 kB
34ffb57d5713 13 hours ago /bin/sh -c apt-get update && apt-get install 37.32 MB
1b71dfd71e40 13 hours ago /bin/sh -c echo 'deb http://apt.postgresql.or 66 B
a1b89989f99d 13 hours ago /bin/sh -c #(nop) ENV PG_VERSION=9.5.4-1.pgd 0 B
2c8e74826c5b 13 hours ago /bin/sh -c #(nop) ENV PG_MAJOR=9.5 0 B
11d2cea562f6 13 hours ago /bin/sh -c apt-key adv --keyserver ha.pool.sk 4.538 kB
a69a87fa5b1d 13 hours ago /bin/sh -c mkdir /docker-entrypoint-initdb.d 0 B
ba64506ab206 13 hours ago /bin/sh -c #(nop) ENV LANG=en_US.utf8 0 B
0eda09bda60d 13 hours ago /bin/sh -c apt-get update && apt-get install 1.615 MB
407fa3abad4a 13 hours ago /bin/sh -c set -x && apt-get update && apt-g 5.311 MB
93a992be78cd 13 hours ago /bin/sh -c #(nop) ENV GOSU_VERSION=1.7 0 B
c34f75bb6766 15 hours ago /bin/sh -c #(nop) EXPOSE 8080/tcp 0 B
52f497e39022 15 hours ago /bin/sh -c #(nop) ENTRYPOINT ["/docker-entry 0 B
279ea458dc03 15 hours ago /bin/sh -c #(nop) COPY dir:06f3e18251708036e7 90.57 kB
856c03093adf 15 hours ago /bin/sh -c #(nop) COPY dir:7cdd5a4c14b18f4563 13.43 MB
0f2ed69fb1ad 15 hours ago /bin/sh -c #(nop) COPY file:dead660e078f1fb15 294 B
f707ffb0d62e 15 hours ago /bin/sh -c #(nop) ADD file:0c1885686e63beacf7 72.24 kB
cac987db82a8 15 hours ago /bin/sh -c #(nop) COPY dir:86af9edc26a678a31a 1.919 kB
b24972a0f508 15 hours ago /bin/sh -c apt-get update && apt-get -qq -y i 89.63 MB
32be14c196e3 21 hours ago /bin/sh -c groupadd -r app -g 433 && mkdir / 147.2 kB
319d2f4a017f 21 hours ago /bin/sh -c gpg --keyserver pool.sks-keyserver 132.8 MB
0cd53bbacb64 2 days ago /bin/sh -c apt-get update && apt-get install 203.1 MB
f473448176dc 2 days ago /bin/sh -c cd / && wget https://repo1.maven 6.936 MB
270334f34e77 2 days ago /bin/sh -c #(nop) ENV PHP_BUILD_DEPS=bzip2 0 B
e5c040ab4015 2 days ago /bin/sh -c #(nop) ENV PHP_INI_DIR=/usr/local 0 B
c7e46e9e4df7 2 days ago /bin/sh -c #(nop) ENV PHP_VERSION=5.6.24 0 B
37ec6aa6e336 3 days ago /bin/sh -c #(nop) ENV WM_VERSION=1.57 0 B
0f0168d4061c 3 days ago /bin/sh -c #(nop) ENV WM_PKG_NAME=wiremock 0 B
69a777edb6dc 2 weeks ago /bin/sh -c /var/lib/dpkg/info/ca-certificates 418.2 kB
<missing> 2 weeks ago /bin/sh -c set -x && apt-get update && apt- 349.3 MB
<missing> 2 weeks ago /bin/sh -c #(nop) ENV CA_CERTIFICATES_JAVA_VE 0 B
<missing> 2 weeks ago /bin/sh -c #(nop) ENV JAVA_DEBIAN_VERSION=8u1 0 B
<missing> 2 weeks ago /bin/sh -c #(nop) ENV JAVA_VERSION=8u102 0 B
<missing> 2 weeks ago /bin/sh -c #(nop) ENV JAVA_HOME=/usr/lib/jvm/ 0 B
<missing> 2 weeks ago /bin/sh -c { echo '#!/bin/sh'; echo 'set 87 B
<missing> 2 weeks ago /bin/sh -c #(nop) ENV LANG=C.UTF-8 0 B
<missing> 2 weeks ago /bin/sh -c echo 'deb http://httpredir.debian. 61 B
<missing> 2 weeks ago /bin/sh -c apt-get update && apt-get install 1.286 MB
<missing> 4 weeks ago /bin/sh -c apt-get update && apt-get install 122.6 MB
<missing> 4 weeks ago /bin/sh -c apt-get update && apt-get install 44.3 MB
<missing> 4 weeks ago /bin/sh -c #(nop) CMD ["/bin/bash"] 0 B
<missing> 4 weeks ago /bin/sh -c #(nop) ADD file:0e0565652aa852f620 125.1 MB
At first the "missing" layer ID had my spider senses twitching but this is apparently due to some internal layer key referencing changes in Docker 1.10. These layers, however, are the ones from the java:8 build. The full --no-trunc version is here - http://pastebin.com/0VcBTAVc
Running the images
php-cli-wiremock
docker pull localhost:5000/php-cli-wiremock:latest; docker run -it --rm localhost:5000/php-cli-wiremock:latest ls -l /usr/bin/java
lrwxrwxrwx 1 root root 22 Aug 10 18:41 /usr/bin/java -> /etc/alternatives/java
php-cli-wiremock-postgres
docker pull localhost:5000/php-cli-wiremock-postgres:latest; docker run -it --rm localhost:5000/php-cli-wiremock-postgres:latest ls -l /usr/bin/java
ls: cannot access /usr/bin/java: No such file or directory
Notes
I am running this on Docker for Mac with a containerised private registry (localhost:5000)
Docker version is 1.12
I have run with docker build --no-cache
Inspect outputs
java:8
Matthews-iMac:container-management matt$ docker inspect java:8
+ docker inspect java:8
[
{
"Id": "sha256:69a777edb6dcb32c2e717f69f281ee405cef6deac6de24520aefe76594a6eae5",
"RepoTags": [
"java:8"
],
"RepoDigests": [
"java#sha256:1064e0e67166f8859dd7e1aa1104ffc00133bcf19dbd426447cce6f90319031e"
],
"Parent": "",
"Comment": "",
"Created": "2016-08-10T18:41:32.240355112Z",
"Container": "b8c4a5096022b105ae0795a451a259263077e32c1b546406eb176bffa337b815",
"ContainerConfig": {
"Hostname": "2da0903ff372",
"Domainname": "",
"User": "",
"AttachStdin": false,
"AttachStdout": false,
"AttachStderr": false,
"Tty": false,
"OpenStdin": false,
"StdinOnce": false,
"Env": [
"PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin",
"LANG=C.UTF-8",
"JAVA_HOME=/usr/lib/jvm/java-8-openjdk-amd64",
"JAVA_VERSION=8u102",
"JAVA_DEBIAN_VERSION=8u102-b14.1-1~bpo8+1",
"CA_CERTIFICATES_JAVA_VERSION=20140324"
],
"Cmd": [
"/bin/sh",
"-c",
"/var/lib/dpkg/info/ca-certificates-java.postinst configure"
],
"ArgsEscaped": true,
"Image": "sha256:16b9751e127e1164753a577be9cab63f2c878012f936cfaf4c3ac44e37d6ca49",
"Volumes": null,
"WorkingDir": "",
"Entrypoint": null,
"OnBuild": [],
"Labels": {}
},
"DockerVersion": "1.10.3",
"Author": "",
"Config": {
"Hostname": "2da0903ff372",
"Domainname": "",
"User": "",
"AttachStdin": false,
"AttachStdout": false,
"AttachStderr": false,
"Tty": false,
"OpenStdin": false,
"StdinOnce": false,
"Env": [
"PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin",
"LANG=C.UTF-8",
"JAVA_HOME=/usr/lib/jvm/java-8-openjdk-amd64",
"JAVA_VERSION=8u102",
"JAVA_DEBIAN_VERSION=8u102-b14.1-1~bpo8+1",
"CA_CERTIFICATES_JAVA_VERSION=20140324"
],
"Cmd": [
"/bin/bash"
],
"ArgsEscaped": true,
"Image": "sha256:16b9751e127e1164753a577be9cab63f2c878012f936cfaf4c3ac44e37d6ca49",
"Volumes": null,
"WorkingDir": "",
"Entrypoint": null,
"OnBuild": [],
"Labels": {}
},
"Architecture": "amd64",
"Os": "linux",
"Size": 643047426,
"VirtualSize": 643047426,
"GraphDriver": {
"Name": "aufs",
"Data": null
},
"RootFS": {
"Type": "layers",
"Layers": [
"sha256:2f71b45e4e254ddceb187b1467f5471f0e14d7124ac2dd7fdd7ddbc76e13f0e5",
"sha256:66d8e5ee400cb0660c8c0ad51d30d822365a995eb90d35750a1e641cae7c887c",
"sha256:1050aff7cfff31f37ff91f26ebe8583521a9329da5a7d179400228551b1506cf",
"sha256:c6952565c883c0d36287bfa0dadfe1caa2a5b8a92b10413dc0747396aae87fd4",
"sha256:a0163fd1c828b8da7e032443fa62e41c4dc8d8275419ae9e6b9f43a36162faaf",
"sha256:1a6f9199aa61e7043b82e2c69556ea17c72183c3dbca3276b08cdfdca6ee61aa",
"sha256:5778f887b92c3a990e398921f0eac0c5ddac01d90ee0af731a1f7a2cf13b1463",
"sha256:e4ecd84596333b047c22385770f8325c18dab2157505917006c0cb6436071695"
]
}
}
]
php-cli-wiremock-postgres
+ docker inspect localhost:5000/php-cli-wiremock-postgres:latest
[
{
"Id": "sha256:b6243b6f44fc3dff8cbbcbc91fc3715e136c3a65141744e5b3373454702f37ae",
"RepoTags": [
"localhost:5000/php-cli-wiremock-postgres:latest"
],
"RepoDigests": [
"localhost:5000/php-cli-wiremock-postgres#sha256:0546a57c3b35742b2e1b2eaad583529ba69086fcfc23172fdf39ac7da360be19"
],
"Parent": "sha256:cb7b81da318114a78b5aec213677af517c294225fca54c523ce6d850daaa8fed",
"Comment": "",
"Created": "2016-08-26T11:52:20.102044903Z",
"Container": "98db8815817150473887720b87d61143fa0890b100a7085e82a08bab3ddf2c08",
"ContainerConfig": {
"Hostname": "2da0903ff372",
"Domainname": "",
"User": "",
"AttachStdin": false,
"AttachStdout": false,
"AttachStderr": false,
"ExposedPorts": {
"5432/tcp": {},
"8080/tcp": {}
},
"Tty": false,
"OpenStdin": false,
"StdinOnce": false,
"Env": [
"PATH=/usr/lib/postgresql/9.5/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin",
"LANG=en_US.utf8",
"JAVA_HOME=/usr/lib/jvm/java-8-openjdk-amd64",
"JAVA_VERSION=8u102",
"JAVA_DEBIAN_VERSION=8u102-b14.1-1~bpo8+1",
"CA_CERTIFICATES_JAVA_VERSION=20140324",
"WM_PKG_NAME=wiremock",
"WM_VERSION=1.57",
"PHP_VERSION=5.6.24",
"PHP_INI_DIR=/usr/local/etc/php",
"PHP_BUILD_DEPS=bzip2 \t\tfile \t\tlibbz2-dev \t\tlibcurl4-openssl-dev \t\tlibjpeg-dev \t\tlibmcrypt-dev \t\tlibpng12-dev \t\tlibreadline6-dev \t\tlibssl-dev \t\tlibxslt1-dev \t\tlibxml2-dev \t\tlibreadline-dev \t\tlibncursesw5-dev \t\tlibnewt-dev",
"GOSU_VERSION=1.7",
"PG_MAJOR=9.5",
"PG_VERSION=9.5.4-1.pgdg80+1",
"PGDATA=/var/lib/postgresql/data"
],
"Cmd": [
"/bin/sh",
"-c",
"#(nop) ",
"EXPOSE 5432/tcp"
],
"ArgsEscaped": true,
"Image": "sha256:cb7b81da318114a78b5aec213677af517c294225fca54c523ce6d850daaa8fed",
"Volumes": null,
"WorkingDir": "",
"Entrypoint": [
"/docker-entrypoint.sh"
],
"OnBuild": [],
"Labels": {}
},
"DockerVersion": "1.12.0",
"Author": "",
"Config": {
"Hostname": "2da0903ff372",
"Domainname": "",
"User": "",
"AttachStdin": false,
"AttachStdout": false,
"AttachStderr": false,
"ExposedPorts": {
"5432/tcp": {},
"8080/tcp": {}
},
"Tty": false,
"OpenStdin": false,
"StdinOnce": false,
"Env": [
"PATH=/usr/lib/postgresql/9.5/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin",
"LANG=en_US.utf8",
"JAVA_HOME=/usr/lib/jvm/java-8-openjdk-amd64",
"JAVA_VERSION=8u102",
"JAVA_DEBIAN_VERSION=8u102-b14.1-1~bpo8+1",
"CA_CERTIFICATES_JAVA_VERSION=20140324",
"WM_PKG_NAME=wiremock",
"WM_VERSION=1.57",
"PHP_VERSION=5.6.24",
"PHP_INI_DIR=/usr/local/etc/php",
"PHP_BUILD_DEPS=bzip2 \t\tfile \t\tlibbz2-dev \t\tlibcurl4-openssl-dev \t\tlibjpeg-dev \t\tlibmcrypt-dev \t\tlibpng12-dev \t\tlibreadline6-dev \t\tlibssl-dev \t\tlibxslt1-dev \t\tlibxml2-dev \t\tlibreadline-dev \t\tlibncursesw5-dev \t\tlibnewt-dev",
"GOSU_VERSION=1.7",
"PG_MAJOR=9.5",
"PG_VERSION=9.5.4-1.pgdg80+1",
"PGDATA=/var/lib/postgresql/data"
],
"Cmd": null,
"ArgsEscaped": true,
"Image": "sha256:cb7b81da318114a78b5aec213677af517c294225fca54c523ce6d850daaa8fed",
"Volumes": null,
"WorkingDir": "",
"Entrypoint": [
"/docker-entrypoint.sh"
],
"OnBuild": [],
"Labels": {}
},
"Architecture": "amd64",
"Os": "linux",
"Size": 1133462572,
"VirtualSize": 1133462572,
"GraphDriver": {
"Name": "aufs",
"Data": null
},
"RootFS": {
"Type": "layers",
"Layers": [
"sha256:2f71b45e4e254ddceb187b1467f5471f0e14d7124ac2dd7fdd7ddbc76e13f0e5",
"sha256:66d8e5ee400cb0660c8c0ad51d30d822365a995eb90d35750a1e641cae7c887c",
"sha256:1050aff7cfff31f37ff91f26ebe8583521a9329da5a7d179400228551b1506cf",
"sha256:c6952565c883c0d36287bfa0dadfe1caa2a5b8a92b10413dc0747396aae87fd4",
"sha256:a0163fd1c828b8da7e032443fa62e41c4dc8d8275419ae9e6b9f43a36162faaf",
"sha256:1a6f9199aa61e7043b82e2c69556ea17c72183c3dbca3276b08cdfdca6ee61aa",
"sha256:5778f887b92c3a990e398921f0eac0c5ddac01d90ee0af731a1f7a2cf13b1463",
"sha256:e4ecd84596333b047c22385770f8325c18dab2157505917006c0cb6436071695",
"sha256:942a8ea4fa066724a265d07c7d35f6c45f393d1ce914f8ca40d83e99af65bf85",
"sha256:94a8ddf232d34524edf57c10e86aecdc87c5e6b28c35bbace94b68197a36b609",
"sha256:003a5be98635727e92806f0c7961f4d8f7281a7289389acfb55145966f4d424e",
"sha256:d615c4e8af228c611c96d3d9867f2d9f9a90200e6cfffeaf777ac0374cb476b7",
"sha256:5dee5fbf6d8f7117e2a9f759612b5c875610d1b378b48030be9ce0703385164c",
"sha256:fb09a6741ff94b60f5a9dc292fd13fc0d6a19eaba49d6b8eebbd677467d66574",
"sha256:049561e8ed827b1a45d57148442c313af7585572d224ebe2a8338d9970febe14",
"sha256:838640dbcacdaafacb5fab5b53d4118ad42a6a7cc221c49cc0ab497ee8fc9322",
"sha256:385eb0d637e83a16a7848b37eb0532bb96c8a87aa88da7a8e479b0cd9d6568d7",
"sha256:b01776fa0320292eeb78b5bdf9f3154627d57ea8c691f7f6e54686eba2785d9f",
"sha256:adcebb7a5f805da7487b7b7a28addebe5260861ef238f32fd60bb663388962f7",
"sha256:74bf92ac3fdd233ca67fd82bd7af11ffb46a77575a670b7b5eef1f26cc076766",
"sha256:939e18c0cc00dfc57f2474ca1078996038ebe0ef66a54ebd58d5534769a239e2",
"sha256:20a1c7a1d1d224dc5d14ebd4118dd41b6f836903d0c0bb17c82d39ce5b80d68d",
"sha256:a073365847a62f6d5bedd4d85cfba0d64fc17dd9f3d3fd04ef38416709b0570f",
"sha256:a66bd2f198ff2b97a46edb3b9fd7339ef29a3df9a08a2047d0d87d21105260a9",
"sha256:515034b141d70165c0d589777b1115ca18c601bdaddd6d44ead95a8056c7eade",
"sha256:9bb3e8a75f5fc430427a8a3c76e3be31ef471dd129b767667ceb74d63c41e8a3",
"sha256:a4df8a72c1e91d9c07c219667e48f7a197baee694ada5098da2c5689fae6068e",
"sha256:3380f90fc77766f3268563948a9bddac916dbcb30748bd3e06acc119deee962f",
"sha256:0306af8e0aff6d94becb4bd7fa4f7943b2187253cfd3b6e54ea488d5429ef926"
]
}
}
]
Docker has a layer limit, and that is were you are running into. Try to merge as many RUN Statements as possible, using ’&&’. yes, this means you will not be able to group your sections as you did sementically but rather by statement type and dependency order
http://www.extellisys.com/articles/docker-layer-overload
Related
Upload a file to a virtual machine on apache server
I have a small problem which would be a great help. I have a function in laravel that captures certain data and at the end with $ file-> move ($ virtual_machine_address, document) it is saved in the created folder. This locally works wonders. The code is referenced fromsubir archivos en laravel (API) public function uploadFile(Request $request){ /*Initializing variables in input*/ $input = $request->all(); /*rutas de carpeta*/ $ruta_server = DIRECTORY_SEPARATOR.DIRECTORY_SEPARATOR.'172.xx.xx.xxx'.DIRECTORY_SEPARATOR.'Prueba'.DIRECTORY_SEPARATOR.'DOCUMENTOS'.DIRECTORY_SEPARATOR; /*Enter if file exist*/ if($request->hasFile('file')){ /*Modification in the name and extension*/ $file = $request->file('file'); $filename = $file->getclientOriginalName(); $filename = pathinfo($filename, PATHINFO_FILENAME); $name_file = str_replace(" ", "_", $filename); $extension = $file->getClientOriginalExtension(); /*Redacción o revisión*/ if($input['posicion'] == 1){ $picture = 'Redaccion('.$input['version'].')' . '-' . $name_file . '.' . $extension; }else{ $picture = 'Revision('.$input['version'].')' . '-' . $name_file . '.' . $extension; } /*official root*/ $ruta_oficial = $ruta_server.$input['id_carpeta'].DIRECTORY_SEPARATOR; /*create and uploadfile*/ $file->move($ruta_oficial, $picture); return response()->json([ "ok" => true, "error" => false, "data" => $picture ]); }else{ return response()->json([ "ok" => false, "error" => true, "mensaje" => "Error Detectado" ]); } } I created a container in docker that simulates the apache server configuration where the project will be uploaded and when testing my function with postman, it doesn't work. Sending the error: Symfony\Component\HttpFoundation\File\Exception\FileException: Unable to create the "//172.xx.xx.xxx/Prueba/DOCUMENTOS/100-2021/" directory. in file /opt/data/vendor/symfony/http-foundation/File/File.php on line 125 Along with 38 # more bugs. My project versions: Laravel: 8.48.0 PHP: 8.0.7 Docker container: FROM php:8.0.7-apache (Linux) File server (172.xx.xx.xxx): Windows Virtual Server
This is my DockerFile FROM php:8.0.7-apache RUN apt-get update # 1. paauetes dev RUN apt-get install -y \ git \ zip \ samba \ smbclient \ curl \ sudo \ unzip \ libpq-dev \ libzip-dev \ libicu-dev \ libbz2-dev \ libpng-dev \ libjpeg-dev \ libmcrypt-dev \ libreadline-dev \ libfreetype6-dev \ libsmbclient-dev \ g++ \ libaio1 wget && apt-get clean autoclean && apt-get autoremove --yes && rm -rf /var/lib/{apt,dpkg,cache,log}/ # 2. dir apache ENV APACHE_HOME /var/www/html # 3. mod_rewrite for URL rewrite and mod_headers for .htaccess extra headers like Access-Control-Allow-Origin- RUN a2enmod rewrite headers # 4. start with base php config, then add extensions #RUN mv "$PHP_INI_DIR/php.ini-development" "$PHP_INI_DIR/php.ini" RUN docker-php-ext-install \ gd\ bz2 \ intl \ iconv \ bcmath \ opcache \ calendar \ # mbstring \ # pdo_mysql \ zip # 5. composer COPY --from=composer:latest /usr/bin/composer /usr/bin/composer # ORACLE oci RUN mkdir /opt/oracle \ && cd /opt/oracle ADD http://git.xxx.xxx/bxxxx.xxxx/media/raw/master/IC/instantclient-basic-linux.x64-19.5.0.0.0dbru.zip /opt/oracle ADD http://git.xxx.xxx/bxxxx.xxxx/media/raw/master/IC/instantclient-sdk-linux.x64-19.5.0.0.0dbru.zip /opt/oracle # Install Oracle Instantclient RUN unzip /opt/oracle/instantclient-basic-linux.x64-19.5.0.0.0dbru.zip -d /opt/oracle \ && unzip /opt/oracle/instantclient-sdk-linux.x64-19.5.0.0.0dbru.zip -d /opt/oracle \ # && ln -s /opt/oracle/instantclient_19_5/libclntsh.so.19.1 /opt/oracle/instantclient_19_5/libclntsh.so \ && ln -s /opt/oracle/instantclient_19_5/libclntshcore.so.19.1 /opt/oracle/instantclient_19_5/libclntshcore.so \ # && ln -s /opt/oracle/instantclient_19_5/libocci.so.19.1 /opt/oracle/instantclient_19_5/libocci.so \ && rm -rf /opt/oracle/*.zip ENV LD_LIBRARY_PATH /opt/oracle/instantclient_19_5:${LD_LIBRARY_PATH} # Install Oracle extensions RUN echo 'instantclient,/opt/oracle/instantclient_19_5/' | pecl install oci8-3.0.1 \ && docker-php-ext-enable \ oci8 \ && docker-php-ext-configure pdo_oci --with-pdo-oci=instantclient,/opt/oracle/instantclient_19_5,19.5 \ && docker-php-ext-install \ pdo_oci RUN mkdir -p /opt/data/public && \ rm -r /var/www/html && \ ln -s /opt/data/public $APACHE_HOME WORKDIR $APACHE_HOME
Getting error at the time of run .sh script from DockerFile
My DockerFile is : FROM postgres:latest VOLUME /var/lib/postgresql/data ARG PG_POSTGRES_PWD=123qwe ARG DBUSER=postgres ARG DBUSER_PWD=123qwe ARG DBNAME=docker_pg_sh ARG DB_DUMP_FILE=gtma_latest.sql ENV POSTGRES_DB docker_pg_sh ENV POSTGRES_USER postgres ENV POSTGRES_PASSWORD ${PG_POSTGRES_PWD} ENV PGDATA /pgdata COPY wait-for-pg-isready.sh /tmp/wait-for-pg-isready.sh COPY ${DB_DUMP_FILE} /gtma_latest.sql RUN set -e && \ nohup bash -c "docker-entrypoint.sh postgres & " && \ /tmp/wait-for-pg-isready.sh && \ psql -U postgres -c "CREATE USER ${DBUSER} WITH SUPERUSER CREATEDB CREATEROLE ENCRYPTED PASSWORD '${DBUSER_PWD}';" && \ psql -U ${DBUSER} -d ${POSTGRES_DB} -c "CREATE DATABASE ${DBNAME} TEMPLATE template0;" && \ pg_restore -v --no-owner --role=${DBUSER} --exit-on-error -U ${DBUSER} -d ${DBNAME} </gtma_latest.sql && \ psql -U postgres -c "ALTER USER ${DBUSER} WITH NOSUPERUSER;" && \ rm -rf /gtma_latest.sql HEALTHCHECK --interval=30s --timeout=30s --start-period=5s --retries=3 \ CMD pg_isready -U postgres -d docker_pg_sh and wait-for-pg-isready.sh file is : #!/bin/bash set -e get_non_lo_ip() { local _ip _non_lo_ip _line _nl=$'\n' while IFS=$': \t' read -a _line ;do [ -z "${_line%inet}" ] && _ip=${_line[${#_line[1]}>4?1:2]} && [ "${_ip#127.0.0.1}" ] && _non_lo_ip=$_ip done< <(LANG=C /sbin/ifconfig) printf ${1+-v} $1 "%s${_nl:0:$[${#1}>0?0:1]}" $_non_lo_ip } get_non_lo_ip NON_LO_IP until pg_isready -h $NON_LO_IP -U "postgres" -d "docker_pg_sh"; do >&2 echo "Postgres is not ready - sleeping..." sleep 4 done >&2 echo "Postgres is up - you can execute commands now" Both file are in same folder. But when I run the command docker build -t gmta-test-sh-vol:1.0.0 . , I am getting error like this : Step 14/15 : RUN set -e && nohup bash -c "docker-entrypoint.sh postgres & " && /tmp/wait-for-pg-isready.sh && psql -U postgres -c "CREATE USER ${DBUSER} WITH SUPERUSER CREATEDB CREATEROLE ENCRYPTED PASSWORD '${DBUSER_PWD}';" && psql -U ${DBUSER} -d ${POSTGRES_DB} -c "CREATE DATABASE ${DBNAME} TEMPLATE template0;" && pg_restore -v --no-owner --role=${DBUSER} --exit-on-error -U ${DBUSER} -d ${DBNAME} </gtma_latest.sql && psql -U postgres -c "ALTER USER ${DBUSER} WITH NOSUPERUSER;" && rm -rf /gtma_latest.sql ---> Running in a791e734c6df /bin/sh: 1: /tmp/wait-for-pg-isready.sh: not found The command '/bin/sh -c set -e && nohup bash -c "docker-entrypoint.sh postgres & " && /tmp/wait-for-pg-isready.sh && psql -U postgres -c "CREATE USER ${DBUSER} WITH SUPERUSER CREATEDB CREATEROLE ENCRYPTED PASSWORD '${DBUSER_PWD}';" && psql -U ${DBUSER} -d ${POSTGRES_DB} -c "CREATE DATABASE ${DBNAME} TEMPLATE template0;" && pg_restore -v --no-owner --role=${DBUSER} --exit-on-error -U ${DBUSER} -d ${DBNAME} </gtma_latest.sql && psql -U postgres -c "ALTER USER ${DBUSER} WITH NOSUPERUSER;" && rm -rf /gtma_latest.sql' returned a non-zero code: 127 But there is no error when the line for copy the file wait-for-pg-isready.sh is running . How can the problem will be solved? Thanks in advance.
sed not working in dockerfile but in container bash it does
I'm creating a Docker image where I use sed to modify two parameters, but when i create the images and check the file I wanted to modify it remanis the same. If i run the very sed command interactively, i t works. Why? Could sombebody help me make ma image work without having to modify every container. Dockerfile FROM python:slim-buster WORKDIR /home/scr_dca COPY . . ENV FLASK_APP Screenly.py RUN apt-get update && \ apt install curl gnupg -y && \ curl https://packages.microsoft.com/keys/microsoft.asc | apt-key add - && \ curl https://packages.microsoft.com/config/debian/10/prod.list > /etc/apt/sources.list.d/mssql-release.list && \ apt-get update && ACCEPT_EULA=Y apt-get install msodbcsql17 unixodbc-dev -y && \ apt-get install libgssapi-krb5-2 g++ gcc && \ pip3 install -r requirements.txt --trusted-host pypi.python.org RUN sed -i "s/\(MinProtocol *= *\).*/\1TLSv1.0 /" "/etc/ssl/openssl.cnf" && \ sed -i "s/\(CipherString *= *\).*/\1DEFAULT#SECLEVEL=1 /" "/etc/ssl/openssl.cnf" CMD ["gunicorn", "-b", ":8000", "scr_dca:app"] I'm doing docker run --name mycontainer -d -p 5050:8000 src_dca_v1.0 docker container exec -it mycontainer bash :/home/myapp# cat /etc/ssl/openssl.cnf I checked and sed didnt work during the image creation so I ran the following commands: sed -i "s/\(MinProtocol *= *\).*/\1TLSv1.0 /" "/etc/ssl/openssl.cnf" sed -i "s/\(CipherString *= *\).*/\1DEFAULT#SECLEVEL=1 /" "/etc/ssl/openssl.cnf" original part of the file I want to modify: [system_default_sect] MinProtocol = TLSv1.2 CipherString = #SECLEVEL=1 sed expected result [system_default_sect] MinProtocol = TLSv1.0 CipherString = DEFAULT#SECLEVEL=1
I suspect there is something you are not seeing or that you did not explain/describe in your question. As is, I cannot reproduce your problem. My MCVE, inspired by your current question to test: FROM python:slim-buster RUN cp /etc/ssl/openssl.cnf /etc/ssl/openssl.cnf.ORI && \ sed -i "s/\(MinProtocol *= *\).*/\1TLSv1.0 /" "/etc/ssl/openssl.cnf" && \ sed -i "s/\(CipherString *= *\).*/\1DEFAULT#SECLEVEL=1 /" "/etc/ssl/openssl.cnf" && \ (diff -u /etc/ssl/openssl.cnf.ORI /etc/ssl/openssl.cnf || exit 0) Note: I ignored diff exit status and force it to 0, as it will exit with status 1 when there is a difference between the files which would fail the build. And the result: $ docker build --no-cache -t test:test . Sending build context to Docker daemon 4.096kB Step 1/2 : FROM python:slim-buster ---> 3d8f801fc3db Step 2/2 : RUN cp /etc/ssl/openssl.cnf /etc/ssl/openssl.cnf.ORI && sed -i "s/\(MinProtocol *= *\).*/\1TLSv1.0 /" "/etc/ssl/openssl.cnf" && sed -i "s/\(CipherString *= *\).*/\1DEFAULT#SECLEVEL=1 /" "/etc/ssl/openssl.cnf" && (diff -u /etc/ssl/openssl.cnf.ORI /etc/ssl/openssl.cnf || exit 0) ---> Running in 523ddc0f4025 --- /etc/ssl/openssl.cnf.ORI 2020-01-09 16:21:44.667348574 +0000 +++ /etc/ssl/openssl.cnf 2020-01-09 16:21:44.675348574 +0000 ## -358,5 +358,5 ## system_default = system_default_sect [system_default_sect] -MinProtocol = TLSv1.2 -CipherString = DEFAULT#SECLEVEL=2 +MinProtocol = TLSv1.0 +CipherString = DEFAULT#SECLEVEL=1 Removing intermediate container 523ddc0f4025 ---> 88c28529ceb5 Successfully built 88c28529ceb5 Successfully tagged test:test As you can see, diff is showing the differences before/after running sed and the modifications you are expecting are there. We can also make sure those modifications persist when starting a container from this image: $ docker run -it --rm --name testcmd test:test bash -c "grep -A 2 '\[system_default_sect\]' /etc/ssl/openssl.cnf" [system_default_sect] MinProtocol = TLSv1.0 CipherString = DEFAULT#SECLEVEL=1
Issue accessing external exadata database from docker
I am having a problem accessing external exadata database from docker. Docker File: FROM centos:7.3.1611 WORKDIR /tmp ADD . /tmp ENV http_proxy=<added> ENV https_proxy=<added> ENV RHEL_FRONTEND=noninteractive ENV ORACLE_INSTANTCLIENT_MAJOR=12.2 ENV ORACLE_INSTANTCLIENT_VERSION=12.2.0.1.0 ENV ORACLE=/usr ENV ORACLE_HOME=$ORACLE/lib/oracle/$ORACLE_INSTANTCLIENT_MAJOR/client64 ENV LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$ORACLE_HOME/lib ENV C_INCLUDE_PATH=$C_INCLUDE_PATH:$ORACLE/include/oracle/$ORACLE_INSTANTCLIENT_MAJOR/client64 RUN yum update && yum install -y libaio1 \ curl rpm2cpio cpio \ && mkdir $ORACLE && TMP_DIR="$(mktemp -d)" && cd "$TMP_DIR" \ && oracle-instantclient$ORACLE_INSTANTCLIENT_MAJOR-basic-$ORACLE_INSTANTCLIENT_VERSION-1.x86_64.rpm -o basic.rpm \ && rpm2cpio basic.rpm | cpio -i -d -v && cp -r usr/* $ORACLE && rm -rf ./* \ && ln -s libclntsh.so.12.1 $ORACLE/lib/oracle/$ORACLE_INSTANTCLIENT_MAJOR/client64/lib/libclntsh.so.$ORACLE_INSTANTCLIENT_MAJOR \ && ln -s libocci.so.12.1 $ORACLE/lib/oracle/$ORACLE_INSTANTCLIENT_MAJOR/client64/lib/libocci.so.$ORACLE_INSTANTCLIENT_MAJOR \ && oracle-instantclient$ORACLE_INSTANTCLIENT_MAJOR-devel-$ORACLE_INSTANTCLIENT_VERSION-1.x86_64.rpm -o devel.rpm \ && rpm2cpio devel.rpm | cpio -i -d -v && cp -r usr/* $ORACLE && rm -rf "$TMP_DIR" \ && echo "$ORACLE_HOME/lib" > /etc/ld.so.conf.d/oracle.conf && chmod o+r /etc/ld.so.conf.d/oracle.conf && ldconfig \ && rm -rf /var/lib/apt/lists/* && apt-get purge -y --auto-remove curl rpm2cpio cpio RUN pip --no-cache-dir install Flask==0.12.2 ENV SHELL /bin/bash EXPOSE 80 # WORKDIR /docker ENTRYPOINT ["python"] CMD ["app.py"] Error:returned a non-zero code: 1 Can anyone help me to resolve this?
The build command fails when executing the below command: RUN yum update && yum install -y libaio1 \ curl rpm2cpio cpio \ && mkdir $ORACLE && TMP_DIR="$(mktemp -d)" && cd "$TMP_DIR" \ && oracle-instantclient$ORACLE_INSTANTCLIENT_MAJOR-basic-$ORACLE_INSTANTCLIENT_VERSION-1.x86_64.rpm -o basic.rpm \ && rpm2cpio basic.rpm | cpio -i -d -v && cp -r usr/* $ORACLE && rm -rf ./* \ && ln -s libclntsh.so.12.1 $ORACLE/lib/oracle/$ORACLE_INSTANTCLIENT_MAJOR/client64/lib/libclntsh.so.$ORACLE_INSTANTCLIENT_MAJOR \ && ln -s libocci.so.12.1 $ORACLE/lib/oracle/$ORACLE_INSTANTCLIENT_MAJOR/client64/lib/libocci.so.$ORACLE_INSTANTCLIENT_MAJOR \ && oracle-instantclient$ORACLE_INSTANTCLIENT_MAJOR-devel-$ORACLE_INSTANTCLIENT_VERSION-1.x86_64.rpm -o devel.rpm \ && rpm2cpio devel.rpm | cpio -i -d -v && cp -r usr/* $ORACLE && rm -rf "$TMP_DIR" \ && echo "$ORACLE_HOME/lib" > /etc/ld.so.conf.d/oracle.conf && chmod o+r /etc/ld.so.conf.d/oracle.conf && ldconfig \ && rm -rf /var/lib/apt/lists/* && apt-get purge -y --auto-remove curl rpm2cpio cpio
How can I get Elasticsearch running on CoreOS?
I've a CoreOS cluster with three servers (on Digital Ocean), at this moment running MongoDB. Now I want to start Elasticsearch on this cluster with 1 replica (not using the Mongo river). I followed the description as outlined here. Resulting in two services, elasticsearch#.service & elasticsearch-discovery#.service. elasticsearch#.service [Unit] Description=ElasticSearch service After=etcd.service After=docker.service Before=elasticsearch-discovery#%i.service Requires=elasticsearch-discovery#%i.service [Service] KillMode=none TimeoutStartSec=0 TimeoutStopSec=360 EnvironmentFile=/etc/environment ExecStartPre=-/usr/bin/docker kill %p-%i ExecStartPre=-/usr/bin/docker rm %p-%i ExecStartPre=-/usr/bin/bash -c "echo PreKill and rm done;" ExecStartPre=/usr/bin/mkdir -p /data/elasticsearch ExecStartPre=/usr/bin/docker pull dockerfile/elasticsearch ExecStartPre=/usr/bin/bash -c "echo mkdir and docker pull done;" ExecStart=/bin/bash -c "\ echo StartingUp; \ curl -f ${COREOS_PUBLIC_IPV4}:4001/v2/keys/services/elasticsearch; \ if [ $? = 0 ]; then \ UNICAST_HOSTS = $(etcdctl ls --recursive /services/elasticsearch | sed 's/\/services\/elasticsearch\///g' | sed 's/$/:9300/' | paste -s -d ','); \ echo Key found; \ else \ UNICAST_HOSTS=''; \ echo No Key found; \ fi;" ExecStartPost=/bin/bash -c "\ echo Starting Docker; \ /usr/bin/docker run \ --name %p-%i \ --publish 9200:9200 \ --publish 9300:9300 \ --volume /data/elasticsearch:/data \ dockerfile/elasticsearch \ /elasticsearch/bin/elasticsearch \ --node.name=%p-%i \ --cluster.name=nvssearch \ --network.publish_host=${COREOS_PUBLIC_IPV4} \ --discovery.zen.ping.multicast.enabled=false \ --discovery.zen.ping.unicast.hosts=$UNICAST_HOSTS;" ExecStop=/bin/bash/ -c "/usr/bin/docker kill %p-%i" Restart=on-failure [X-Fleet] X-Conflicts=%p#*.service elasticsearch-discovery#.service [Unit] Description=ElasticSearch discovery service BindsTo=elasticsearch#%i.service After=elasticsearch#%i.service [Service] EnvironmentFile=/etc/environment ExecStart=/bin/bash -c '\ while true; do \ curl -f ${COREOS_PUBLIC_IPV4}:9200; \ if [ "$?" = "0" ]; then \ etcdctl set /services/elasticsearch/${COREOS_PUBLIC_IPV4} \ '{"http_port": 9200, "transport_port": 9300}\' --ttl 60; \ else \ etcdctl rm /services/elasticsearch/${COREOS_PUBLIC_IPV4}; \ fi; \ sleep 45; \ done' ExecStop=/usr/bin.etcdctl rm /services/elasticsearch/${COREOS_PUBLIC_IPV4} [X-Fleet] X-ConditionMachineOf=elasticsearch#%i.service But if I try to run the service (fleetctl submit / load / start elasticsearch#1.service), it immediately dies: elasticsearch#1.service 475f6273.../IP inactive dead Running fleetctl journal elasticsearch#1 results in the following message: Mar 17 09:17:04 nvs-1 systemd[1]: Stopped ElasticSearch service. That's all, no echoes I've added (to the service) are shown, or whatsoever. Anyone any ideas on how to get me further?
It is somewhat simpler to get Elasticsearch running with Weave. My blog post shows how to run it on Vagrant, however moving the same setup to cloud should be pretty straight-forward.
I've followed the same article you did and ran into the same issue. I tracked it down to the docker container not being available anymore, so I change the docker run command in the elasticsearch#service unit: [Unit] Description=ElasticSearch service After=docker.service Requires=docker.service [Service] TimeoutSec=180 EnvironmentFile=/etc/environment ExecStartPre=/usr/bin/mkdir -p /data/elasticsearch ExecStartPre=/usr/bin/docker pull elasticsearch ExecStart=/bin/bash -c '\ curl -f ${COREOS_PRIVATE_IPV4}:4001/v2/keys/services/elasticsearch; \ if [ "$?" = "0" ]; then \ UNICAST_HOSTS=$(etcdctl ls --recursive /services/elasticsearch \ | sed "s/\/services\/elasticsearch\///g" \ | sed "s/$/:9300/" \ | paste -s -d","); \ else \ UNICAST_HOSTS=""; \ fi; \ /usr/bin/docker run \ --rm \ --name %p-%i \ --publish 9200:9200 \ --publish 9300:9300 \ --volume /data/elasticsearch:/data \ elasticsearch \ --node.name=%p-%i \ --cluster.name=logstash \ --network.publish_host=${COREOS_PRIVATE_IPV4} \ --discovery.zen.ping.multicast.enabled=false \ --discovery.zen.ping.unicast.hosts=$UNICAST_HOSTS' ExecStop=/usr/bin/docker stop %p-%i ExecStop=/usr/bin/docker rm %p-%i [X-Fleet] X-Conflicts=%p#*.service Apart from that I think, on your original post, you're missing some quotes, double quotes and have some wrong blank spaces. This is my current elastic-discovery#service for reference: [Unit] Description=ElasticSearch discovery service BindsTo=elasticsearch#%i.service [Service] EnvironmentFile=/etc/environment ExecStart=/bin/bash -c '\ while true; do \ curl -f ${COREOS_PRIVATE_IPV4}:9200; \ if [ "$?" = "0" ]; then \ etcdctl set /services/elasticsearch/${COREOS_PRIVATE_IPV4} \'{"http_port": 9200, "transport_port": 9300}\' --ttl 60; \ else \ etcdctl rm /services/elasticsearch/${COREOS_PRIVATE_IPV4}; \ fi; \ sleep 45; \ done' ExecStop=/usr/bin/etcdctl rm /services/elasticsearch/${COREOS_PRIVATE_IPV4} [X-Fleet] X-ConditionMachineOf=elasticsearch#%i.service