DevNet Associate DEVASC 200-901 Official Certification Guide by Adrian Iliesiu (z-lib.org)

(andrew) #1

Now you need to tell Docker what port to expose for
networking. In this case, you would expose ports 80 and
443:


EXPOSE 80 443

Next, you create a sharepoint for HTML files in nginx so
that you can give it access to your web files:


VOLUME /usr/share/nginx/html

Finally, set the container to run nginx on launch:


Click here to view code image


CMD ["nginx", "-g", "daemon off;"]

FROM ubuntu:latest
MAINTAINER Cisco Champion ([email protected])
RUN apt-get update && apt-get upgrade -y
RUN apt-get install nginx -y
EXPOSE 80 443
VOLUME /usr/share/nginx/html
CMD ["nginx", "-g", "daemon off;"]

Now that you have a Dockerfile, it’s time to build an
image.


Docker Images


When working with Docker images, you primarily use
the following commands:


build: Builds an image from a Dockerfile.
push: Pushes a local image to a remote registry for storage and
sharing.
ls: List images stored locally.
Free download pdf