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:
zypper ref ; zypper up
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:
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
Images
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:
docker images
You can remove a single image with:
docker rmi mariadb
Manage containers
Show running container:
docker ps
# show all container
docker ps -a
Start/Stop container:
docker start ec93709394bb
docker stop ec93709394bb
Remove container:
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:
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:
docker ps
Use the docker ID as a destination-host to perform a copy:
docker cp firewall.sh 7d1c2b4d6bca:/opt/
Copy docker image to another docker host
To copy an image from one docker host to another you have to save your image as a tar archive:
docker save neo4j > neo4j.tar
Now you can scp or rsync your saved image to another docker host.
The import process es also so easy as the export itself:
docker load < neo4j.tar
Leave a Reply