What is this all about?
Docker is an open-source project that automates the deployment of applications inside software containers, by providing an additional layer of abstraction and automation of operating-system-level virtualization on Linux, Mac OS and Windows.
Container is a lightweight alternative to virtual machine. It uses the host Linux kernel to operate.
Typical applications of Docker:
- web ui
- stateless backend
When
thinking of containers, you should try very hard to throw out what
you might already know about virtual machines and instead
conceptualize a container as a wrapper around a process that actually
runs on the server.
Setting up Docker
System requirements
Docker works only in Linux. We'll install Docker on Cent OS 7.1 64 bit.
Setting up on Linux
Linux is the recommended environment for Docker. Linux 3.8 and up is required. Check your Linux version with the command:
`[user@localhost
~]$ uname -r`
`3.10.0-229.el7.x86_64`
Install Docker with the command:
yum
-y install docker
Run Docker as a service in CentOS 7
Enable the service:
systemctl
enable docker.service
Start the service:
systemctl
start docker.service
Docker systemd configuration
File settings by default are located in /usr/lib/systemd/system and /lib/systemd/system. It is not recommended to change them.
Instead change the file:
/etc/sysconfig/docker
First, you have to change
`OPTIONS='-selinux-enabled'`
to `OPTIONS='-selinux-enabled
-G dockerroot'`.
This will tell that dockerroot group can operate docker containers. If we want to give permissions to users to operate docker then we should add them to the dockerroot group.
Apply changes:
systemctl daemon-reload
Check the changes applied:
systemctl show docker
Restart Docker:
systemctl restart docker
Test the installation
[root@localhost
user]# systemctl status docker
Also, check the docker version:
[root@localhost
user]# docker
version
`Client version: 1.7.1`
`Client API version: 1.19`
`Package Version (client):
docker-1.7.1-115.el7.x86_64`
`Go version (client): go1.4.2`
`Git commit (client):
446ad9b/1.7.1`
`OS/Arch (client): linux/amd64`
`Server version: 1.7.1`
`Server API version: 1.19`
`Package Version (server):
docker-1.7.1-115.el7.x86_64`
`Go version (server): go1.4.2`
`Git commit (server):
446ad9b/1.7.1`
`OS/Arch (server): linux/amd64`
Use docker info to check the docker settings:
docker:
`Containers: 0`
`Images: 5`
`Storage Driver: devicemapper`
`Pool Name:
docker-253:0-67854726-pool`
`Pool Blocksize: 65.54 kB`
`Backing Filesystem: xfs`
`Data file: /dev/loop0`
`Metadata file: /dev/loop1`
`Data Space Used: 509.9 MB`
`Data Space Total: 107.4 GB`
`Data Space Available: 17.18
GB`
`Metadata Space Used: 946.2 kB`
`Metadata Space Total: 2.147
GB`
`Metadata Space Available:
2.147 GB`
`Udev Sync Supported: true`
`Deferred Removal Enabled:
false`
`Data loop file:
/var/lib/docker/devicemapper/devicemapper/data`
`Metadata loop file:
/var/lib/docker/devicemapper/devicemapper/metadata`
`Library Version: 1.02.93-RHEL7
(2015-01-28)`
`Execution Driver: native-0.2`
`Logging Driver: json-file`
`Kernel Version:
3.10.0-229.el7.x86_64`
`Operating System: CentOS Linux
7 (Core)`
`CPUs: 1`
`Total Memory: 1.941 GiB`
`Name: localhost.localdomain`
`ID:
ZROP:MO75:VNFS:ENRM:WJYC:ZY53:S7KU:HJAF:WIIF:BJ7Z:CJZG:WIPD`
Комментариев нет:
Отправить комментарий