Skip to content

Latest commit

 

History

History
105 lines (64 loc) · 3.58 KB

1.Getting-Started-with-Docker.md

File metadata and controls

105 lines (64 loc) · 3.58 KB

Getting Started with Docker

About Web Site - Engineers

Engineers is a sophisticated and free engineering website template with a stunning and appealing to the eye web design. It is based on the powerful Bootstrap Framework, which gives Engineers flexibility and extendability. Indeed, Engineers is 100% mobile-friendly and in tune with all modern web browsers. Everyone will have a pleasant experience, browsing your content and filling out the “request a quote” form.

Other treats of Engineers include a massive slideshow, sticky navigation, testimonials, blog pages, as well as newsletter subscription and contact forms. Instead of starting from complete scratch, Engineers offers you a striking layout which you can put into play right away; the theme is just a click away anyway. Spread the word out with this nifty free engineering website template and start making big moves.

Source: Colorlib

Exercise

In this exercise, we will build a docker image (blueprint for container) for the web site above.

Analogy: In world of Object Oriented programing you can think of them as Class (blueprint) for the Instances you will be creating.

Docker Programming Comment
Image Class Blueprint
Container Object Instance of the Class

Install Docker

Let's get started by installing Docker Engine - Community.Docker is available in three tiers:

  • Docker Engine - Community
  • Docker Engine - Enterprise
  • Docker Enterprise (for running Docker workload in production!)

If you would like to learn about Docker editions

Download Static Website Engineers

Download static website - Engineers and unzip into Engineers folder.

Create Dockerfile

A Dockerfile (filename without extension) is a text document that contains all the commands a user could call on the command line to assemble an image.

See Dockerfile reference

#1. Open Termminal / Command line and navigate to folder containing engineering site

#2. Create a Docker File with following details

DockerFile

# Start with nginx running on alpine
FROM nginx:alpine

# Copy content from current dir to nginx html
COPY . /usr/share/nginx/html

#EXPOSE instruction to inform Docker that the container will be listening on the specified network ports at runtime
EXPOSE 80/tcp

Docker Build

Let's build an image from a Dockerfile and tag it as engineering-app.

See: docker build

#1. Open Termminal / Command line and navigate to folder containing the docker file

#2. Now let's build the docker  
docker build -t engineering-app .

View the Docker Images

List all the Docker Images, you should see engineering-app.

See docker image reference

docker image ls

Docker Run

A container is a process that runs on a host and is statred using Docker Run

Let's run our web app and explose it on port 8080.

See: docker run

docker run -d -p 8080:80 engineering-app

Stretch Goal

Identify command to stop the container and remove it (hint: rm).