Docker Notes
Docker Notes
Docker Notes
Virtualization
Docker
Docker image
Docker Architecture
Installation
The Docker Comunity package is now called “docker-ce“. Let’s add the CE repository for
docker installation.
Centos-7 & RHEL-7
# yum -y install
wget
# wget https://download.docker.com/linux/centos/docker-ce.repo -
O
/etc/yum.repos.d/docker-
ce.repo
Install the latest version of Docker CE using the following command.
#yum
repolist
# yum -y install docker-
ce
Ubuntu-16
Docker commands
#sudo docker version
https://hub.docker.com/
Docker Images
#docker images
Containers
Running a container
Listing containers
#docker ps
#sudo docker ps -a
Docker history
Top container
stop a container
#docker stop conainerID
Remove a container
docker rm ContainerID
docker ps -a -f status=exited --list all stopped containers
docker rm $(docker ps -a -f status=exited) --remove all stopped containers
Container Stats
docker stats ContainerID
Attach a container
docker attach ContainerID
Pause a container
docker pause ContainerID
UnPause a container
docker unpause ContainerID
Kill a container
docker kill ContainerID
docker inspect
#docker inspect <container ID>
Source containers:
Destination container:
#env
#mongo 172.17.0.2:27017
Mongo DB image
#docker pull mongo
#mongo 178.13.0.10:27017
#use demo
nginix image
Nagios
Install
Running
browser: http://localhost:8080
Credentials
The default credentials for the web interface is nagiosadmin / nagios
Networking
#docker network ls
#docker network inspect net-name
Ex:run image then check the above command
publicrepo-name:1.0
Docker compose
Install docker-compose
#sudo curl -L
"https://github.com/docker/compose/releases/download/1.23.2/docker-compose-$(uname
-s)-$(uname -m)" -o /usr/local/bin/docker-compose
#sudo chmod +x /usr/local/bin/docker-compose
#docker-compose --version
#vi docker-compose.yml
version: '2'
services:
databases: image:
mysql ports: -
"3306:3306"
environment:
- MYSQL_ROOT_PASSWORD=password
- MYSQL_USER=user
- MYSQL_PASSWORD=password
- MYSQL_DATABASE=demodbweb:
image: nginx
#docker-compose up –d
#docker-compose ps
Rough Work
Creating a volume
docker volume create --driver local \
--opt type=tmpfs \
--opt device=tmpfs \
--opt o=size=100m,uid=1000 \
--name=test-volume