I'm practicing the examples provided in book Docker in Practice chapter 3. Below is the Dockerfile mentioned to run docker with postgres.
FROM ubuntu:14.04
RUN apt-get update \
&& DEBIAN_FRONTEND=noninteractive apt-get install -y \
postgresql \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*
WORKDIR /opt
COPY db /opt/db
RUN service postgresql start && \
cat db/schema.sql | psql && \
service postgresql stop
But the copy in the step 4 gives me the below error.
$ sudo docker build -t db .
Sending build context to Docker daemon 2.048kB
Step 1/4 : FROM ubuntu:14.04
---> c69811d4e993
Step 2/4 : RUN apt-get update && DEBIAN_FRONTEND=noninteractive
apt-get install -y postgresql && apt-get clean && rm -rf
/var/lib/apt/lists/*
---> Using cache
---> 2ac4ff885d29
Step 3/4 : COPY db /opt/db
COPY failed: stat /var/lib/docker/tmp/docker-builder554911929/db: no such file or directory
when I commented the COPY command, I'm getting different error.
Step 4/4 : RUN service postgresql start && cat db/schema.sql | psql && service postgresql stop
---> Running in 79e47b45c41a
* Starting PostgreSQL 9.3 database server
...done.
cat: db/schema.sql: No such file or directory
psql: FATAL: role "root" does not exist