Part I

Containers are environments that host individual applications using a framework like Docker.

Docker Editions:

  • Docker CE ( community edition ) free version
  • Docker EE ( enterprise edition) Paid

Versions:

  • Stable, released every 4 months.
  • Edge (beta) released every month. For testing
  • EE, support for one year.

Example how to create a container:

$docker container run --publish 80:80 --detach --name webhost nginx

detach: subcommand is to let run the container and keep use the command prompt name: create a container’s name.

$docker container logs “container-name”

Now you’ve got your Docker machines running, Docker Hub repository set up, and Docker Image built, you are ready to deploy the app across your machines. First, push your application to your repository. You’ll find the docker login and docker push commands useful here. Next, pull your application from your repository to your other machines. You can do all of this with the docker run command. It will automatically find, pull, and run your new application.

That’s it! Those are the steps to use Docker to easily deploy an application to multiple machines.

Some useful commands:

$docker ps -a -q | xargs docker rm -v

To delete all container stopped

$docker container ls

Show current running containers

$docker exec -it <containerIdOrName> bash

NOTE:

Remember the docker port publishing format of :. Port conflict errors occur when multiple services are running on the same published port on the same host, not in multiple containers. Each container gets its own internal IP behind NAT, so the ports won’t conflict across two container network interfaces.

Moreover the official website: Docker Samples