Differences
This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision | ||
docker_basic_configuration [2020/01/23 12:40] – andonovj | docker_basic_configuration [2020/01/25 04:02] (current) – external edit 127.0.0.1 | ||
---|---|---|---|
Line 24: | Line 24: | ||
gpgkey=https:// | gpgkey=https:// | ||
[root@postgresqlmaster yum.repos.d]# | [root@postgresqlmaster yum.repos.d]# | ||
- | [root@postgresqlmaster yum.repos.d]# yum install docker-engine | + | [root@postgresqlpgpool app]# yum install docker-ce docker-ce-cli containerd.io |
Loaded plugins: fastestmirror, | Loaded plugins: fastestmirror, | ||
Loading mirror speeds from cached hostfile | Loading mirror speeds from cached hostfile | ||
- | * base: mirror-pl.kielcetechnologypark.net | + | * base: ftp.cvut.cz |
- | * extras: ftp.agh.edu.pl | + | * extras: ftp.cvut.cz |
- | * updates: | + | * updates: |
- | base | 3.6 kB 00:00:00 | + | |
- | dockerrepo | + | |
- | extras | + | |
- | pgdg10 | + | |
- | pgdg11 | + | |
- | pgdg94 | + | |
- | pgdg95 | + | |
- | pgdg96 | + | |
- | updates | + | |
- | dockerrepo/ | + | |
Resolving Dependencies | Resolving Dependencies | ||
--> Running transaction check | --> Running transaction check | ||
- | ---> Package | + | ---> Package |
- | --> Processing Dependency: docker-engine-selinux | + | ---> |
- | --> Processing Dependency: libcgroup for package: docker-engine-17.05.0.ce-1.el7.centos.x86_64 | + | ---> |
- | --> | + | --> Finished |
- | --> Running transaction check | + | |
- | ---> Package docker-engine-selinux.noarch 0:17.05.0.ce-1.el7.centos | + | |
- | Installed: | + | |
- | docker-engine.x86_64 0: | + | |
- | ******************************************************************************************************************************** | + | |
- | Dependency | + | |
- | audit-libs-python.x86_64 0: | + | |
- | libtool-ltdl.x86_64 0: | + | |
- | Dependency Updated: | + | Dependencies Resolved |
- | | + | |
+ | =========================================================================================================================================================================================================================== | ||
+ | | ||
+ | =========================================================================================================================================================================================================================== | ||
+ | Installing: | ||
+ | containerd.io | ||
+ | | ||
+ | | ||
+ | |||
+ | Transaction Summary | ||
+ | =========================================================================================================================================================================================================================== | ||
+ | Install | ||
+ | |||
+ | Total size: 87 M | ||
+ | Installed size: 362 M | ||
+ | Is this ok [y/d/N]: y | ||
+ | Downloading packages: | ||
+ | Running transaction check | ||
+ | Running transaction test | ||
+ | Transaction test succeeded | ||
+ | Running transaction | ||
+ | Installing : 1: | ||
+ | Installing | ||
+ | Installing : 3: | ||
+ | Verifying | ||
+ | Verifying | ||
+ | Verifying | ||
+ | |||
+ | Installed: | ||
+ | containerd.io.x86_64 0:1.2.10-3.2.el7 | ||
Complete! | Complete! | ||
+ | [root@postgresqlpgpool app]# service docker start | ||
+ | Redirecting to / | ||
+ | [root@postgresqlpgpool app] | ||
</ | </ | ||
Line 136: | Line 150: | ||
Let's start by downloading and installing MySQL database which has been dockerized. | Let's start by downloading and installing MySQL database which has been dockerized. | ||
- | ====MySQL | + | ====MySQL |
Once we have docker installed, we can search and install any image we want: | Once we have docker installed, we can search and install any image we want: | ||
Line 186: | Line 200: | ||
</ | </ | ||
- | By default the " | + | ===Install MySQL=== |
- | + | Now we can install the mysql image using the following commands: | |
- | <sxh bash> | + | |
- | [root@localhost ~]# docker run hello-world | + | |
- | Unable to find image ' | + | |
- | latest: Pulling from library/ | + | |
- | 9db2ca6ccae0: | + | |
- | Digest: sha256: | + | |
- | Status: Downloaded newer image for hello-world: | + | |
- | + | ||
- | Hello from Docker! | + | |
- | This message shows that your installation appears to be working correctly. | + | |
- | + | ||
- | To generate this message, Docker took the following steps: | + | |
- | 1. The Docker client contacted the Docker daemon. | + | |
- | 2. The Docker daemon pulled the " | + | |
- | (amd64) | + | |
- | 3. The Docker daemon created a new container from that image which runs the | + | |
- | executable that produces the output you are currently reading. | + | |
- | 4. The Docker daemon streamed that output to the Docker client, which sent it | + | |
- | to your terminal. | + | |
- | + | ||
- | To try something more ambitious, you can run an Ubuntu container with: | + | |
- | $ docker run -it ubuntu bash | + | |
- | + | ||
- | Share images, automate workflows, and more with a free Docker ID: | + | |
- | | + | |
- | + | ||
- | For more examples and ideas, visit: | + | |
- | | + | |
- | </ | + | |
- | + | ||
- | + | ||
- | Now we can install the mysql image as follows: | + | |
<sxh bash> | <sxh bash> | ||
Line 249: | Line 231: | ||
cloudfoundry/ | cloudfoundry/ | ||
ansibleplaybookbundle/ | ansibleplaybookbundle/ | ||
+ | |||
+ | </ | ||
+ | |||
+ | ===Download (pull) MySQL)=== | ||
+ | <sxh bash> | ||
[root@localhost ~]# docker pull mysql | [root@localhost ~]# docker pull mysql | ||
Using default tag: latest | Using default tag: latest | ||
Line 261: | Line 248: | ||
[root@localhost ~]# docker images | [root@localhost ~]# docker images | ||
REPOSITORY | REPOSITORY | ||
- | mysql latest | ||
hello-world | hello-world | ||
- | mysql/ | + | mysql |
</ | </ | ||
- | + | ===Start the MySQL=== | |
- | We can see now, that I have installed | + | We can see now, that I have installed |
<sxh bash> | <sxh bash> | ||
- | [root@localhost ~]# docker run --name | + | [root@postgresqlmaster yum.repos.d]# docker run --name |
- | 0cb5ef2781b253a98f67028ca7f9b2e6934ee8560718401f54bd46e07a9972d6 | + | d434caf757cfc946d074fbabe44c9a14117d18b8e0451d06afb81a94facbe540 |
[root@localhost ~]# | [root@localhost ~]# | ||
</ | </ | ||
+ | ===Login to the host=== | ||
+ | <sxh bash> | ||
+ | [root@postgresqlmaster yum.repos.d]# | ||
+ | CONTAINER ID IMAGE | ||
+ | d434caf757cf | ||
+ | [root@postgresqlmaster yum.repos.d]# | ||
+ | root@d434caf757cf:/# | ||
+ | |||
+ | </ | ||
+ | |||
+ | |||
+ | ===Connect to the DB=== | ||
+ | And voila we can connect to the DB :) | ||
+ | <sxh bash> | ||
+ | [root@localhost ~]# docker exec -it d434caf757c mysql -uroot -p <- ' | ||
+ | Enter password: | ||
+ | Welcome to the MySQL monitor. | ||
+ | Your MySQL connection id is 14 | ||
+ | Server version: 8.0.11 MySQL Community Server - GPL | ||
+ | |||
+ | Copyright (c) 2000, 2018, Oracle and/or its affiliates. All rights reserved. | ||
+ | |||
+ | Oracle is a registered trademark of Oracle Corporation and/or its | ||
+ | affiliates. Other names may be trademarks of their respective | ||
+ | owners. | ||
+ | |||
+ | Type ' | ||
+ | mysql> | ||
+ | </ | ||
+ | ===Check Logs=== | ||
We can check the logs of the installation as follows: | We can check the logs of the installation as follows: | ||
Line 352: | Line 367: | ||
Finally, we can connect to the mysql, by running the mysql command from the docker: | Finally, we can connect to the mysql, by running the mysql command from the docker: | ||
- | |||
- | <sxh bash> | ||
- | [root@localhost ~]# docker exec -it mysql2 mysql -uroot -p <- ' | ||
- | Enter password: | ||
- | Welcome to the MySQL monitor. | ||
- | Your MySQL connection id is 14 | ||
- | Server version: 8.0.11 MySQL Community Server - GPL | ||
- | |||
- | Copyright (c) 2000, 2018, Oracle and/or its affiliates. All rights reserved. | ||
- | |||
- | Oracle is a registered trademark of Oracle Corporation and/or its | ||
- | affiliates. Other names may be trademarks of their respective | ||
- | owners. | ||
- | |||
- | Type ' | ||
- | mysql> | ||
- | </ | ||
- | |||
====Mongo Configuration==== | ====Mongo Configuration==== |