Giter VIP home page Giter VIP logo

dockertemplate's Introduction

dockerTemplate

Docker cli, server, registry

Docker registries

  • Docker Hub is a public registry that anyone can use, and Docker is configured to look for images on Docker Hub by default

Use Case

Running your own Registry is a great solution to integrate with and complement your CI/CD system. In a typical workflow, a commit to your source revision control system would trigger a build on your CI system, which would then push a new image to your Registry if the build is successful. A notification from the Registry would then trigger a deployment on a staging environment, or notify other systems that a new image is available.

Dockerfiles

  • ADD - copies the files from a source on the host into the container's own filesystem at the set destination
  • CMD - can be used for executing a specific command within the container
  • ENTRYPOINT - sets a default application to be used every time a container is created with the image
  • ENV - sets environment variables
  • EXPOSE - associates a specific port to enable networking between the container and the outside world
  • FROM - defines the base image used to start the build process
  • MAINTAINER - defines a full name and email address of the image creator
  • RUN - central executing directive for Dockerfiles
  • USER - sets the UID (or username) which is to run the container
  • VOLUME - is used to enable access from the container to a directory on the host machine
  • WORKDIR - sets the path where the command, defined with CMD, is to be executed

Create a .dockerignore file in the same directory as your Dockerfile. This will prevent your local modules and debug logs from being copied onto your Docker image.

Build images from Dockerfile

  • docker build -t "NAME:Dockerfile" .
  • docker build -t "webdev:Dockerfile" .
  • docker build -t "appdev:Dockerfile" .
  • docker build -t "secdev:Dockerfile" .
  • docker images - list all docker immages

Containers

  • A container is a runnable instance of an image

Services

  • Scale containers
  • Create replicas
  • Swarm mode
  1. Define your app’s environment with a Dockerfile so it can be reproduced anywhere.

  2. Define the services that make up your app in docker-compose.yml so they can be run together in an isolated environment.

  3. Run docker-compose up and Compose starts and runs your entire app.

  • You can set a custom project name by using the -p command line option or the COMPOSE_PROJECT_NAME environment variable.

Integrate Dockerfile into docker-compose.yml

  • see docker-compose.yml
  • docker-compose up/down/restart
  • you could also define everything within the docker-compose.yml file, but making use of both Dockerfile and docker-compose.yml makes for a much more flexible and efficient system

Dockerizing a nodejs web app

dockertemplate's People

Contributors

d023975 avatar

Watchers

James Cloos avatar  avatar

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.