It can run anything and will make a small OS that takes care of your dependencies.
Yes a Virtual Machine like Oracle's Virtualbox can do it too, but it requires a lot of resources. Docker will only bundle what you need to run your application.
Example:
If you need one server that runs PHP5 to make the old applications work and another server running PHP7 to make your newest apps work then docker can run both for you.
It will make containers that hold the right environment for you!
Sounds magic so I must try it of course:
Installation:
I found Docker in my standard Manjaro repo so i simply installed it.
Then I started and enabled the Docker service like this:
Code: Select all
sudo systemctl start docker.service
and
Code: Select all
sudo systemctl enable docker.service
I also did a:
Code: Select all
tee /etc/modules-load.d/loop.conf <<< "loop"
and
Code: Select all
modprobe loop
..because docker needs the loop module on the first run.
Since I want to use Docker as a regular user I added myself to the docker group
Code: Select all
sudo gpasswd -a viking60 docker
This will make me root every time with Docker.
Rebooted...and checked if Docker was running:
Code: Select all
docker info
It came up with this:
Code: Select all
Containers: 0
Running: 0
Paused: 0
Stopped: 0
Images: 0
Server Version: 1.12.5
Storage Driver: aufs
Root Dir: /var/lib/docker/aufs
Backing Filesystem: extfs
Dirs: 0
Dirperm1 Supported: true
Logging Driver: json-file
Cgroup Driver: cgroupfs
Plugins:
Volume: local
Network: bridge host null overlay
Swarm: inactive
Runtimes: runc
Default Runtime: runc
Security Options: seccomp
Kernel Version: 4.8.15-1-MANJARO
Operating System: Manjaro Linux
OSType: linux
Architecture: x86_64
CPUs: 8
Total Memory: 5.822 GiB
Name: thomas-pc
ID: 2WPO:JRI7:7UJM:OLPW:EXNT:JDUX:TYMA:GVSE:T6IT:OJ4U:KGFK:HSD4
Docker Root Dir: /var/lib/docker
Debug Mode (client): false
Debug Mode (server): false
Registry: https://index.docker.io/v1/
Insecure Registries:
127.0.0.0/8
So far so good then time to start using this thing....
Using docker:
I am using Manjaro so time to pull a "different" OS aka Arch Linux:
Code: Select all
docker pull base/archlinux
and it works!
Code: Select all
docker pull base/archlinux
Using default tag: latest
latest: Pulling from base/archlinux
a3ed95caeb02: Pull complete
80ab36053684: Pull complete
Digest: sha256:7905fad7578b9852999935fb0ba9c32fe16cece9e4d1d742a34f55ce9cebdfd1
Status: Downloaded newer image for base/archlinux:latest
To check what Docker images i have - I do a:
Code: Select all
docker images
Which now indicates that I have archlinux at my disposal.
Wow ! Now I have to figure out howto pull Centos and Suse and Ubuntu and......
Time to search for centos then I simply typed:
Code: Select all
docker search centos
And there it was a huge list of images that I could use - the default Centos docker image is simply called "centos"
So here we go:
Code: Select all
docker pull centos
No problem there; the image was pulled so now I have a default Centos at my disposal too:
Code: Select all
~/ docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
centos latest 67591570dd29 3 weeks ago 191.8 MB
base/archlinux latest f915fe624ef8 18 months ago 278.8 MB
Now let us see if we can start a container running Centos:
Code: Select all
docker run -ti centos
Yes!
I am in Centos and Yum works!
I updated Centos and noticed that it comes without nano so I installed it:
Code: Select all
yum install nano
No problem
So now I can run a Centos server on my Manjaro box or simply run ArchLinux....
To see what OS' I have running I can simply type
Code: Select all
docker ps
As you can see - Centos is running
Code: Select all
~/ docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS
c0d7812e056a centos "/bin/bash" 4 minutes ago Up 4 minutes tiny_borg
If you want to run GUI programs you need to install xorg-x11 in the container.
If you want to install a Centos server with wordpress running you can search for lamp and pull
nickistre/centos-lamp-wordpress
There are many Docker images that are "prepared" for you.
If you want to remove the docker image from your computer it is easily done like this;
Code: Select all
docker rmi centos
To find the IP of the docker container I had to check the hostname and then do a:
Code: Select all
docker inspect 290e983aaf87 | grep IPAddress
290e983aaf87 beeing the hostname.
Doing ip addr or ifconfig will not help.
In my case the IP was something like 172.17.0.2
This might be because I use dnsmasq and dnscrypt that could influence the docker network interface.