Reputation: 10250
I was just reading a docker file HERE.
and basically the Dockerfile looks like follows:
FROM postgres:9.1
MAINTAINER Mike Dillon <[email protected]>
ENV POSTGIS_MAJOR 2.1
ENV POSTGIS_VERSION 2.1.7+dfsg-3~94.git954a8d0.pgdg80+1
RUN apt-get update \
&& apt-get install -y --no-install-recommends \
postgresql-$PG_MAJOR-postgis-$POSTGIS_MAJOR=$POSTGIS_VERSION \
postgis=$POSTGIS_VERSION \
&& rm -rf /var/lib/apt/lists/*
RUN mkdir -p /docker-entrypoint-initdb.d
COPY ./initdb-postgis.sh /docker-entrypoint-initdb.d/postgis.sh
I want to make sure i have interpreted the below two commands correctly:
RUN mkdir -p /docker-entrypoint-initdb.d
COPY ./initdb-postgis.sh /docker-entrypoint-initdb.d/postgis.sh
The RUN command is running a mkdir
command , which means the current directory will have a subdirectory called:
/docker-entrypoint-initdb.d
andin the next command I.E. the COPY command the contents of the directory ./initdb-postgis.sh
are being copied into /docker-entrypoint-initdb.d/postgis.sh
, am i right ?
Upvotes: 1
Views: 137
Reputation: 9176
RUN cmd
is used to execute cmd
command and will create and commit a new layer for the image your are building. So those commands are run in the context of the image that is being building. mkdir -p /docker-entrypoint-initdb.d
will create a new folder docker-entrypoint-initdb.d
in the root of the image. COPY ./initdb-postgis.sh /docker-entrypoint-initdb.d/postgis.sh
will copy the file initdb-postgis.sh
(that has to be located at the same level you have run the docker build command
to the file /docker-entrypoint-initdb.d/postgis.sh
inside the container.
Upvotes: 2