Giter Site home page Giter Site logo

docker_hello's Introduction

Docker Hello

This is an example of using Docker. Look inside Dockerfile, it's based on the official nginx image.

Ensure that your PC have Docker installed.

Installation

  1. Clone this repo
git clone [email protected]:yesnik/docker_hello.git
  1. Bulid an image with the repo name docker_hello and tag 1.0
cd docker_hello
docker build -t docker_hello:1.0 .
  1. Ensure that the image has been created
docker images
  1. Create container based on our image
docker run --name docker_hello_container -d -p 8080:80 docker_hello:1.0

Params:

  • --name docker_hello_container - name of the created container
  • -d - detaches from the container, running it in the background
  • -p 8080:80 - maps network ports. Your host's port 8080 will be mapped to container's 80 port
  • docker_hello:1.0 - image's name
  1. Visit page: http://127.0.0.1:8080/. You'll see the message from index.html file.

Play with the container

  1. Look at the running containers
docker ps
  1. Connect to the container and use bash
docker exec -it docker_hello_container bash

Flag -it attaches us to an interactive tty in the container.

  1. To exit container press Ctrl + D

  2. Stop the container

docker stop docker_hello_container
  1. Remove the container
docker rm docker_hello_container
  1. Ensure that the container has been deleted
docker ps -a

You won't see docker_hello_container in the list.

Conclusion

In this repo we have created self-contained web server that could easily serve many web documents. We can deploy it on any server with Docker.

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.