The official Docker documentation is more than enough for the installation and configuration.
For the quick jump into the docker world I wrote some references from the official documentation down.
So the most important steps from the requirements and the main guideline for the installation:
– Docker requires a 64-bit installation
– Kernel must be 3.10 at minimum
Update the system to actual level:
Bring to live
This example was written on openSUSE 15.1 with Kernel 4.12.14
zypper in docker
Start docker service and anable for autostart:
systemctl start docker systemctl enable docker
Test the Docker installation:
docker run hello-world
Make more with docker and run an interactive container with os of your choise:
1 2 3 4 5
docker run -t -i ubuntu /bin/bash docker run -t -i debian /bin/bash docker run -t -i centos /bin/bash docker run -t -i opensuse /bin/bash docker run -t -i debian:stable-slim /bin/bash
You can find more images on hub.docker.com.
From command line as follow:
docker search maria
Pull a image from the above search result:
docker pull mariadb
Show local available docker images:
You can remove a single image with:
docker rmi mariadb
Show running container:
1 2 3
docker ps # show all container docker ps -a
docker start ec93709394bb docker stop ec93709394bb
docker rm ec93709394bb
Attach to the console of a running container
docker attach f5b92d45888
Another way to attach the console – exec command runs a new command in a running container.
docker exec -it test01.example.com bash
Container with custom names
Can be very useful to manage your container instead of cryptical predefined IDs like this one 0234f60fe02f.
See the following examples to work with container names:
1 2 3 4 5
docker run --name test01.example.com -t -i opensuse/leap /bin/bash docker start test01.example.com docker attach test01.example.com docker stop test01.example.com docker rm test01.example.com
More information is in the docker Userguide available.
Copy files into docker container
To copy a single file from host system into a container find out your container docker ID with:
Use the docker ID as a destination-host to perform a copy:
docker cp firewall.sh 7d1c2b4d6bca:/opt/