Git Product home page Git Product logo

docker-exercise-webpage's Introduction

Step 1: Creating a docker host

Note: you can skip this step if you already have a docker host to use or want to provision it some other way, just set DOCKER_HOST like:

$ export DOCKER_HOST="tcp://192.168.99.100:2376"

To create a docker host, you'll need to have docker machine installed: https://docs.docker.com/machine/install-machine/

For this example, I'll create the docker host as a local virtualbox vm, but you can alternatively create them using various cloud providers and hypervisors: https://docs.docker.com/machine/driver

To create the docker host:

$ docker-machine create -d virtualbox demo
Creating VirtualBox VM...
Creating SSH key...
Starting VirtualBox VM...
Starting VM...
To see how to connect Docker to this machine, run: docker-machine env demo
$ docker-machine ls
NAME   ACTIVE   DRIVER       STATE     URL                         SWARM
demo   *        virtualbox   Running   tcp://192.168.99.100:2376
$ docker-machine env demo
export DOCKER_TLS_VERIFY="1"
export DOCKER_HOST="tcp://192.168.99.100:2376"
export DOCKER_CERT_PATH="/home/josh/.docker/machine/machines/demo"
export DOCKER_MACHINE_NAME="demo"
# Run this command to configure your shell: 
# eval "$(docker-machine env demo)"

Then configure your local docker client to connect to your new machine:

$ eval "$(docker-machine env demo)"

Step 2: Build and run the container

$ docker build -t exercise-webpage .

Kill any already running containers:

$ docker ps -q | xargs docker kill

Run the container:

$ docker run -dp 8000:80 exercise-webpage
2e9ef239d27a43c0a8951197060a820d9ef6650f9c7788716019df23ea0f9c44

Did it work?

$ curl http://192.168.99.100:8000

Step 4: Profit!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.