Showing posts with label Docker. Show all posts
Showing posts with label Docker. Show all posts

Tuesday, May 15, 2018

Docker Quick Reference

In My Words
"Docker automates the repetitive tasks of setting up and configuring multiple (dev/qa/prod) environments so that developers can focus on what matters: building great software"

Listing containers


# List running containers 
docker ps

# List all containers
docker ps -a 

Starting/Stopping containers

# Start 
docker start containerName

# Stop
docker stop containerName

Removing containers

# Remove container 
docker rm containerName

# Stop and remove container
docker rm -f containerName

# Remove all exited containers
docker rm -v $(docker ps -a -q -f status=exited)

Running commands in new containers

docker run imageName command arguments

# Example
docker run docker/whalesay cowsay Hello

# Assign a name to the container
docker run --name myName docker/whalesay cowsay Hello

# Run with a specific tag of an image
docker run node:6.9.1 node --version

# Run container in background
docker run -d -p 80:80 --name webserver nginx
See Docker run reference for more …

Images

Listing local images

docker images

Removing images

docker rmi imageName

# Remove unwanted dangling images
docker rmi $(docker images -f "dangling=true" -q)

Searching for images

# Search the Docker Hub for images
docker search searchWord

Pulling images

docker pull imageName

# Pull a specific tag
docker pull imageName:tag

# Example: Get a specific node version
docker pull node:6.9.1

Building image from Dockerfile

docker build .

# Name the image
docker build -t imageName .

# Tag the image
docker build -t imageName:1.0.0 .

Docker Swarm Cluster Creation

PS C:\windows\system32> docker swarm init --advertise-addr 10.79.124.174
Swarm initialized: current node (x6ekx7h660cg8nkneujs0n0jf) is now a manager.

To add a worker to this swarm, run the following command:

docker swarm join --token SWMTKN-1-04osgsy3kig1sdzl0q13w7sw5964515jt6c9dkqvjzsk6tntne-1ascqzq63u3gd6xrmp3qzk8ew 10.7
9.124.174:2377

To add a manager to this swarm, run 'docker swarm join-token manager' and follow the instructions.

Wednesday, February 5, 2014

Docker Overview

In this post, I will document the learning I had with Docker.

Container History

- Linux Containers

  • Open VZ 
    • Single patched linux kernal ability to use architecture kernel version of system for executing the container
  • Linux V-Server
    • Virtual Private Server implementation. Created for adding OS level virtualization to the linux kernel itself.
What's a Container?
  • OS level Virtualization.
  • Kernel of OS allowing multiple isolated user space instances instead of one. 
  • Like real server from point of view of operator.
What is Docker?
Docker is an open-source project to easily create lightweight, portable, self-sufficient containers from any application. The same container that a developer builds and tests on a laptop can run at scale, in production, on VMs, bare metal, OpenStack clusters, public clouds and more.

Technology behind Docker 

  • Developed using Google's Go language
  • with Linux kernel using cgroup & cnames (namespace)
  • AUFS union filesystem
  • LxC (Linux containers)

TB typed more...as i learn...