Lab 3: Create an image with COPY instruction

Create an image with COPY instruction

Dockerfile

FROM nginx:alpine
LABEL maintainer="microfocus"

COPY index.html /usr/share/nginx/html/
ENTRYPOINT ["nginx", "-g", "daemon off;"]

Lets create the index.html file

echo "Welcome to Docker" > index.html

Building Docker Image

docker image build -t cpy:v1 .

Staring the container

docker container run -d --rm --name myapp1 -p 80:80 cpy:v1

Checking index file

curl localhost

Welcome to Docker

COPY instruction in Multi-stage Builds

Dockerfile

Building Docker Image

Staring the container

Checking index file

Last updated

Was this helpful?