docker_basic_configuration

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
docker_basic_configuration [2020/01/23 12:48] andonovjdocker_basic_configuration [2020/01/25 04:02] (current) – external edit 127.0.0.1
Line 24: Line 24:
 gpgkey=https://yum.dockerproject.org/gpg gpgkey=https://yum.dockerproject.org/gpg
 [root@postgresqlmaster yum.repos.d]# [root@postgresqlmaster yum.repos.d]#
-[root@postgresqlmaster yum.repos.d]# yum install docker-engine -y+[root@postgresqlpgpool app]# yum install docker-ce docker-ce-cli containerd.io
 Loaded plugins: fastestmirror, langpacks Loaded plugins: fastestmirror, langpacks
 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: mirror.hosting90.cz + * updates: ftp.cvut.cz
-base                                                                                                                                                                                                | 3.6 kB  00:00:00 +
-dockerrepo                                                                                                                                                                                          | 2.9 kB  00:00:00 +
-extras                                                                                                                                                                                              | 2.9 kB  00:00:00 +
-pgdg10                                                                                                                                                                                              | 3.6 kB  00:00:00 +
-pgdg11                                                                                                                                                                                              | 3.6 kB  00:00:00 +
-pgdg94                                                                                                                                                                                              | 3.6 kB  00:00:00 +
-pgdg95                                                                                                                                                                                              | 3.6 kB  00:00:00 +
-pgdg96                                                                                                                                                                                              | 3.6 kB  00:00:00 +
-updates                                                                                                                                                                                             | 2.9 kB  00:00:00 +
-dockerrepo/primary_db                                                                                                                                                                                34 kB  00:00:00+
 Resolving Dependencies Resolving Dependencies
 --> Running transaction check --> Running transaction check
----> Package docker-engine.x86_64 0:17.05.0.ce-1.el7.centos will be installed +---> Package containerd.io.x86_64 0:1.2.10-3.2.el7 will be installed 
---> Processing Dependency: docker-engine-selinux >= 17.05.0.ce-1.el7.centos for package: docker-engine-17.05.0.ce-1.el7.centos.x86_64 +---> Package docker-ce.x86_64 3:19.03.5-3.el7 will be installed 
---> Processing Dependencylibcgroup for package: docker-engine-17.05.0.ce-1.el7.centos.x86_64 +---> Package docker-ce-cli.x86_64 1:19.03.5-3.el7 will be installed 
---> Processing Dependency: libltdl.so.7()(64bit) for package: docker-engine-17.05.0.ce-1.el7.centos.x86_64 +--> Finished Dependency Resolution
---> Running transaction check +
----> Package docker-engine-selinux.noarch 0:17.05.0.ce-1.el7.centos will be installed +
-Installed: +
-  docker-engine.x86_64 0:17.05.0.ce-1.el7.centos +
-******************************************************************************************************************************** +
-Dependency Installed: +
-  audit-libs-python.x86_64 0:2.8.5-4.el7  checkpolicy.x86_64 0:2.5-8.el7              docker-engine-selinux.noarch 0:17.05.0.ce-1.el7.centos  libcgroup.x86_64 0:0.41-21.el7     libsemanage-python.x86_64 0:2.5-14.el7 +
-  libtool-ltdl.x86_64 0:2.4.2-22.el7_3    policycoreutils-python.x86_64 0:2.5-33.el7  python-IPy.noarch 0:0.75-6.el7                          setools-libs.x86_64 0:3.3.8-4.el7+
  
-Dependency Updated+Dependencies Resolved 
-  audit.x86_64 0:2.8.5-4.el7                                          audit-libs.x86_64 0:2.8.5-4.el7                                          policycoreutils.x86_64 0:2.5-33.el7+ 
 +=========================================================================================================================================================================================================================== 
 + Package                                              Arch                                          Version                                                  Repository                                               Size 
 +=========================================================================================================================================================================================================================== 
 +Installing
 + containerd.io                                        x86_64                                        1.2.10-3.2.el7                                           docker-ce-stable                                         23 M 
 + docker-ce                                            x86_64                                        3:19.03.5-3.el7                                          docker-ce-stable                                         24 M 
 + docker-ce-cli                                        x86_64                                        1:19.03.5-3.el7                                          docker-ce-stable                                         39 M 
 + 
 +Transaction Summary 
 +=========================================================================================================================================================================================================================== 
 +Install  3 Packages 
 + 
 +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:docker-ce-cli-19.03.5-3.el7.x86_64                                                                                                                                                                    1/3 
 +  Installing containerd.io-1.2.10-3.2.el7.x86_64                                                                                                                                                                     2/3 
 +  Installing : 3:docker-ce-19.03.5-3.el7.x86_64                                                                                                                                                                        3/3 
 +  Verifying  : containerd.io-1.2.10-3.2.el7.x86_64                                                                                                                                                                     1/3 
 +  Verifying  1:docker-ce-cli-19.03.5-3.el7.x86_64                                                                                                                                                                    2/3 
 +  Verifying  : 3:docker-ce-19.03.5-3.el7.x86_64                                                                                                                                                                        3/3 
 + 
 +Installed: 
 +  containerd.io.x86_64 0:1.2.10-3.2.el7                                     docker-ce.x86_64 3:19.03.5-3.el7                                     docker-ce-cli.x86_64 1:19.03.5-3.el7
  
 Complete! Complete!
 +[root@postgresqlpgpool app]# service docker start
 +Redirecting to /bin/systemctl start docker.service
 +[root@postgresqlpgpool app]
 </sxh> </sxh>
  
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 Configuration====+====MySQL Docker====
 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 217: Line 231:
 cloudfoundry/cf-mysql-ci                               Image used in CI of cf-mysql-release            0 cloudfoundry/cf-mysql-ci                               Image used in CI of cf-mysql-release            0
 ansibleplaybookbundle/mysql-apb                        An APB which deploys RHSCL MySQL                0                                       [OK] ansibleplaybookbundle/mysql-apb                        An APB which deploys RHSCL MySQL                0                                       [OK]
 +
 +</sxh>
 +
 +===Download (pull) MySQL)===
 +<sxh bash>
 [root@localhost ~]# docker pull mysql [root@localhost ~]# docker pull mysql
 Using default tag: latest Using default tag: latest
Line 229: Line 248:
 [root@localhost ~]# docker images [root@localhost ~]# docker images
 REPOSITORY           TAG                 IMAGE ID            CREATED             SIZE REPOSITORY           TAG                 IMAGE ID            CREATED             SIZE
-mysql                latest              5dbe5b6313e1        13 hours ago        445MB 
 hello-world          latest              2cb0d9787c4d        2 weeks ago         1.85kB hello-world          latest              2cb0d9787c4d        2 weeks ago         1.85kB
-mysql/mysql-server   latest              02d081b9c73e        3 months ago        300MB+mysql   latest              02d081b9c73e        3 months ago        300MB
 </sxh> </sxh>
  
 ===Start the MySQL=== ===Start the MySQL===
-We can see now, that I have installed 2 mysqls, we can initiate a new container for mysql image as follows:+We can see now, that I have installed mysql, we can initiate a new container for mysql image as follows:
  
 <sxh bash> <sxh bash>
-[root@localhost ~]# docker run --name mysql2 -e MYSQL_ROOT_PASSWORD='oracle' -d mysql/mysql-server:latest +[root@postgresqlmaster yum.repos.d]#  docker run --name mysql -e MYSQL_ROOT_PASSWORD='oracle' -d mysql 
-0cb5ef2781b253a98f67028ca7f9b2e6934ee8560718401f54bd46e07a9972d6+d434caf757cfc946d074fbabe44c9a14117d18b8e0451d06afb81a94facbe540
 [root@localhost ~]# [root@localhost ~]#
 +</sxh>
 +
 +===Login to the host===
 +<sxh bash>
 +[root@postgresqlmaster yum.repos.d]# docker container ls
 +CONTAINER ID        IMAGE               COMMAND                  CREATED             STATUS              PORTS                 NAMES
 +d434caf757cf        mysql               "docker-entrypoint..."   7 seconds ago       Up 6 seconds        3306/tcp, 33060/tcp   mysql
 +[root@postgresqlmaster yum.repos.d]# docker exec -it d434caf757cf /bin/bash
 +root@d434caf757cf:/#
 +
 +</sxh>
 +
 +
 +===Connect to the DB===
 +And voila we can connect to the DB :)
 +<sxh bash>
 +[root@localhost ~]# docker exec -it d434caf757c mysql -uroot -p   <- 'oracle'
 +Enter password:
 +Welcome to the MySQL monitor.  Commands end with ; or \g.
 +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 'help;' or '\h' for help. Type '\c' to clear the current input statement.
 +mysql>
 </sxh> </sxh>
  
Line 319: 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   <- 'oracle' 
-Enter password: 
-Welcome to the MySQL monitor.  Commands end with ; or \g. 
-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 'help;' or '\h' for help. Type '\c' to clear the current input statement. 
-mysql> 
-</sxh> 
- 
  
 ====Mongo Configuration==== ====Mongo Configuration====
  • docker_basic_configuration.1579783710.txt.gz
  • Last modified: 2020/01/23 20:48
  • (external edit)