docker 安装mysql,远程登录问题

[\\vmware-host\Shared Folders\文稿\NetSarang Computer\6\Xshell\Sessions]$ ipconfig

'\\vmware-host\Shared Folders\文稿\NetSarang Computer\6\Xshell\Sessions'
用作为当前目录的以上路径启动了 CMD.EXE。
UNC 路径不受支持。默认值设为 Windows 目录。

Windows IP 配置


以太网适配器 Bluetooth 网络连接:

   媒体状态  . . . . . . . . . . . . : 媒体已断开
   连接特定的 DNS 后缀 . . . . . . . : 

以太网适配器 本地连接:

   连接特定的 DNS 后缀 . . . . . . . : localdomain
   本地链接 IPv6 地址. . . . . . . . : fe80::fc64:569:a94b:97a1%11
   IPv4 地址 . . . . . . . . . . . . : 192.168.67.130
   子网掩码  . . . . . . . . . . . . : 255.255.255.0
   默认网关. . . . . . . . . . . . . : 192.168.67.2

隧道适配器 isatap.{A9927ED4-77F1-4CC8-870A-B383ADDE7E6A}:

   媒体状态  . . . . . . . . . . . . : 媒体已断开
   连接特定的 DNS 后缀 . . . . . . . : 

隧道适配器 isatap.localdomain:

   媒体状态  . . . . . . . . . . . . : 媒体已断开
   连接特定的 DNS 后缀 . . . . . . . : localdomain

[\\vmware-host\Shared Folders\文稿\NetSarang Computer\6\Xshell\Sessions]$ ping 192.168.67.133
'\\vmware-host\Shared Folders\文稿\NetSarang Computer\6\Xshell\Sessions'
用作为当前目录的以上路径启动了 CMD.EXE。
UNC 路径不受支持。默认值设为 Windows 目录。

正在 Ping 192.168.67.133 具有 32 字节的数据:
来自 192.168.67.133 的回复: 字节=32 时间=1ms TTL=64
来自 192.168.67.133 的回复: 字节=32 时间<1ms TTL=64
来自 192.168.67.133 的回复: 字节=32 时间<1ms TTL=64
来自 192.168.67.133 的回复: 字节=32 时间<1ms TTL=64

192.168.67.133 的 Ping 统计信息:
    数据包: 已发送 = 4,已接收 = 4,丢失 = 0 (0% 丢失),
往返行程的估计时间(以毫秒为单位):
    最短 = 0ms,最长 = 1ms,平均 = 0ms

[\\vmware-host\Shared Folders\文稿\NetSarang Computer\6\Xshell\Sessions]$ 

Connecting to 192.168.67.133:22...
Connection established.
To escape to local shell, press 'Ctrl+Alt+]'.
Connection closing...Socket close.

Connection closed by foreign host.

Disconnected from remote host(v-192.168.67.133) at 14:10:21.

Type `help' to learn how to use Xshell prompt.
[\\vmware-host\Shared Folders\文稿\NetSarang Computer\6\Xshell\Sessions]$ 

Connecting to 192.168.67.133:22...
Connection established.
To escape to local shell, press 'Ctrl+Alt+]'.

[root@localhost ~]# ipconfig
bash: ipconfig: command not found...
[root@localhost ~]# ifconfig
ens33: flags=4163  mtu 1500
        inet 192.168.67.133  netmask 255.255.255.0  broadcast 192.168.67.255
        inet6 fe80::eaaa:d098:e0bb:bed2  prefixlen 64  scopeid 0x20
        ether 00:0c:29:0c:b3:95  txqueuelen 1000  (Ethernet)
        RX packets 4418  bytes 3519652 (3.3 MiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 3034  bytes 548654 (535.7 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

lo: flags=73  mtu 65536
        inet 127.0.0.1  netmask 255.0.0.0
        inet6 ::1  prefixlen 128  scopeid 0x10
        loop  txqueuelen 1000  (Local Loopback)
        RX packets 0  bytes 0 (0.0 B)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 0  bytes 0 (0.0 B)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

virbr0: flags=4099  mtu 1500
        inet 192.168.122.1  netmask 255.255.255.0  broadcast 192.168.122.255
        ether 52:54:00:ba:28:c6  txqueuelen 1000  (Ethernet)
        RX packets 0  bytes 0 (0.0 B)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 0  bytes 0 (0.0 B)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

[root@localhost ~]# yum install dcoker
Loaded plugins: fastestmirror, langpacks
Determining fastest mirrors
 * base: mirror.bit.edu.cn
 * extras: mirror.bit.edu.cn
 * updates: mirrors.cqu.edu.cn
base                                                                                                                                                                                                          | 3.6 kB  00:00:00    
extras                                                                                                                                                                                                        | 3.4 kB  00:00:00    
updates                                                                                                                                                                                                       | 3.4 kB  00:00:00    
^Z
[1]+  Stopped                 yum install dcoker
[root@localhost ~]# yum install docker
Loaded plugins: fastestmirror, langpacks
Existing lock /var/run/yum.pid: another copy is running as pid 3952.
Another app is currently holding the yum lock; waiting for it to exit...
  The other application is: yum
    Memory :  25 M RSS (887 MB VSZ)
    Started: Sat Jul 21 02:14:34 2018 - 00:16 ago
    State  : Traced/Stopped, pid: 3952
Another app is currently holding the yum lock; waiting for it to exit...
  The other application is: yum
    Memory :  25 M RSS (887 MB VSZ)
    Started: Sat Jul 21 02:14:34 2018 - 00:18 ago
    State  : Traced/Stopped, pid: 3952
Another app is currently holding the yum lock; waiting for it to exit...
  The other application is: yum
    Memory :  25 M RSS (887 MB VSZ)
    Started: Sat Jul 21 02:14:34 2018 - 00:20 ago
    State  : Traced/Stopped, pid: 3952
Another app is currently holding the yum lock; waiting for it to exit...
  The other application is: yum
    Memory :  25 M RSS (887 MB VSZ)
    Started: Sat Jul 21 02:14:34 2018 - 00:22 ago
    State  : Traced/Stopped, pid: 3952
Another app is currently holding the yum lock; waiting for it to exit...
  The other application is: yum
    Memory :  25 M RSS (887 MB VSZ)
    Started: Sat Jul 21 02:14:34 2018 - 00:24 ago
    State  : Traced/Stopped, pid: 3952
Another app is currently holding the yum lock; waiting for it to exit...
  The other application is: yum
    Memory :  25 M RSS (887 MB VSZ)
    Started: Sat Jul 21 02:14:34 2018 - 00:26 ago
    State  : Traced/Stopped, pid: 3952
Another app is currently holding the yum lock; waiting for it to exit...
  The other application is: yum
    Memory :  25 M RSS (887 MB VSZ)
    Started: Sat Jul 21 02:14:34 2018 - 00:28 ago
    State  : Traced/Stopped, pid: 3952
Another app is currently holding the yum lock; waiting for it to exit...
  The other application is: yum
    Memory :  25 M RSS (887 MB VSZ)
    Started: Sat Jul 21 02:14:34 2018 - 00:30 ago
    State  : Traced/Stopped, pid: 3952
Another app is currently holding the yum lock; waiting for it to exit...
  The other application is: yum
    Memory :  25 M RSS (887 MB VSZ)
    Started: Sat Jul 21 02:14:34 2018 - 00:32 ago
    State  : Traced/Stopped, pid: 3952
Another app is currently holding the yum lock; waiting for it to exit...
  The other application is: yum
    Memory :  25 M RSS (887 MB VSZ)
    Started: Sat Jul 21 02:14:34 2018 - 00:34 ago
    State  : Traced/Stopped, pid: 3952
Another app is currently holding the yum lock; waiting for it to exit...
  The other application is: yum
    Memory :  25 M RSS (887 MB VSZ)
    Started: Sat Jul 21 02:14:34 2018 - 00:36 ago
    State  : Traced/Stopped, pid: 3952
Another app is currently holding the yum lock; waiting for it to exit...
  The other application is: yum
    Memory :  25 M RSS (887 MB VSZ)
    Started: Sat Jul 21 02:14:34 2018 - 00:38 ago
    State  : Traced/Stopped, pid: 3952
Another app is currently holding the yum lock; waiting for it to exit...
  The other application is: yum
    Memory :  25 M RSS (887 MB VSZ)
    Started: Sat Jul 21 02:14:34 2018 - 00:40 ago
    State  : Traced/Stopped, pid: 3952
Another app is currently holding the yum lock; waiting for it to exit...
  The other application is: yum
    Memory :  25 M RSS (887 MB VSZ)
    Started: Sat Jul 21 02:14:34 2018 - 00:42 ago
    State  : Traced/Stopped, pid: 3952
Another app is currently holding the yum lock; waiting for it to exit...
  The other application is: yum
    Memory :  25 M RSS (887 MB VSZ)
    Started: Sat Jul 21 02:14:34 2018 - 00:44 ago
    State  : Traced/Stopped, pid: 3952
Another app is currently holding the yum lock; waiting for it to exit...
  The other application is: yum
    Memory :  25 M RSS (887 MB VSZ)
    Started: Sat Jul 21 02:14:34 2018 - 00:46 ago
    State  : Traced/Stopped, pid: 3952
Another app is currently holding the yum lock; waiting for it to exit...
  The other application is: yum
    Memory :  25 M RSS (887 MB VSZ)
    Started: Sat Jul 21 02:14:34 2018 - 00:48 ago
    State  : Traced/Stopped, pid: 3952
Another app is currently holding the yum lock; waiting for it to exit...
  The other application is: yum
    Memory :  25 M RSS (887 MB VSZ)
    Started: Sat Jul 21 02:14:34 2018 - 00:50 ago
    State  : Traced/Stopped, pid: 3952
Another app is currently holding the yum lock; waiting for it to exit...
  The other application is: yum
    Memory :  25 M RSS (887 MB VSZ)
    Started: Sat Jul 21 02:14:34 2018 - 00:52 ago
    State  : Traced/Stopped, pid: 3952
Another app is currently holding the yum lock; waiting for it to exit...
  The other application is: yum
    Memory :  25 M RSS (887 MB VSZ)
    Started: Sat Jul 21 02:14:34 2018 - 00:54 ago
    State  : Traced/Stopped, pid: 3952
^Z
[2]+  Stopped                 yum install docker
[root@localhost ~]# yum install docker
Loaded plugins: fastestmirror, langpacks
Existing lock /var/run/yum.pid: another copy is running as pid 3952.
Another app is currently holding the yum lock; waiting for it to exit...
  The other application is: yum
    Memory :  25 M RSS (887 MB VSZ)
    Started: Sat Jul 21 02:14:34 2018 - 01:11 ago
    State  : Traced/Stopped, pid: 3952
Another app is currently holding the yum lock; waiting for it to exit...
  The other application is: yum
    Memory :  25 M RSS (887 MB VSZ)
    Started: Sat Jul 21 02:14:34 2018 - 01:13 ago
    State  : Traced/Stopped, pid: 3952
Another app is currently holding the yum lock; waiting for it to exit...
  The other application is: yum
    Memory :  25 M RSS (887 MB VSZ)
    Started: Sat Jul 21 02:14:34 2018 - 01:15 ago
    State  : Traced/Stopped, pid: 3952
^Z
[3]+  Stopped                 yum install docker
[root@localhost ~]# ps -a
   PID TTY          TIME CMD
  3952 pts/1    00:00:00 yum
  3977 pts/1    00:00:00 urlgrabber-ext-
  3978 pts/1    00:00:00 urlgrabber-ext-
  3979 pts/1    00:00:00 urlgrabber-ext-
  3980 pts/1    00:00:00 urlgrabber-ext-
  3981 pts/1    00:00:00 yum
  3992 pts/1    00:00:00 yum
  3993 pts/1    00:00:00 ps
[root@localhost ~]# kill 3981
[root@localhost ~]# kill 3992
[root@localhost ~]# ps -a
   PID TTY          TIME CMD
  3952 pts/1    00:00:00 yum
  3977 pts/1    00:00:00 urlgrabber-ext-
  3978 pts/1    00:00:00 urlgrabber-ext-
  3979 pts/1    00:00:00 urlgrabber-ext-
  3980 pts/1    00:00:00 urlgrabber-ext-
  3981 pts/1    00:00:00 yum
  3992 pts/1    00:00:00 yum
  4003 pts/1    00:00:00 ps
[root@localhost ~]# kill -9 3992
[root@localhost ~]# kill -9 3981
[3]+  Killed                  yum install docker
[root@localhost ~]# ps -a
   PID TTY          TIME CMD
  3952 pts/1    00:00:00 yum
  3977 pts/1    00:00:00 urlgrabber-ext-
  3978 pts/1    00:00:00 urlgrabber-ext-
  3979 pts/1    00:00:00 urlgrabber-ext-
  3980 pts/1    00:00:00 urlgrabber-ext-
  7472 pts/1    00:00:00 ps
[2]+  Killed                  yum install docker
[root@localhost ~]# kill -9 3952
[root@localhost ~]# ps -a
   PID TTY          TIME CMD
 25990 pts/1    00:00:00 ps
[1]+  Killed                  yum install dcoker
[root@localhost ~]# ps -a
   PID TTY          TIME CMD
 35450 pts/1    00:00:00 ps
[root@localhost ~]# ps -a
   PID TTY          TIME CMD
 43475 pts/1    00:00:00 ps
[root@localhost ~]# yum install docker
Loaded plugins: fastestmirror, langpacks
Loading mirror speeds from cached hostfile
 * base: mirror.bit.edu.cn
 * extras: mirror.bit.edu.cn
 * updates: mirrors.cqu.edu.cn
(1/3): extras/7/x86_64/primary_db                                                                                                                                                                             | 172 kB  00:00:00    
(2/3): updates/7/x86_64/primary_db                                                                                                                                                                            | 4.2 MB  00:00:02    
(3/3): base/7/x86_64/primary_db                                                                                                                                                                               | 5.9 MB  00:00:10    
Resolving Dependencies
--> Running transaction check
---> Package docker.x86_64 2:1.13.1-68.gitdded712.el7.centos will be installed
--> Processing Dependency: docker-common = 2:1.13.1-68.gitdded712.el7.centos for package: 2:docker-1.13.1-68.gitdded712.el7.centos.x86_64
--> Processing Dependency: docker-client = 2:1.13.1-68.gitdded712.el7.centos for package: 2:docker-1.13.1-68.gitdded712.el7.centos.x86_64
--> Running transaction check
---> Package docker-client.x86_64 2:1.13.1-68.gitdded712.el7.centos will be installed
---> Package docker-common.x86_64 2:1.13.1-68.gitdded712.el7.centos will be installed
--> Processing Dependency: skopeo-containers >= 1:0.1.26-2 for package: 2:docker-common-1.13.1-68.gitdded712.el7.centos.x86_64
--> Processing Dependency: oci-umount >= 2:2.3.3-3 for package: 2:docker-common-1.13.1-68.gitdded712.el7.centos.x86_64
--> Processing Dependency: oci-systemd-hook >= 1:0.1.4-9 for package: 2:docker-common-1.13.1-68.gitdded712.el7.centos.x86_64
--> Processing Dependency: oci-register-machine >= 1:0-5.13 for package: 2:docker-common-1.13.1-68.gitdded712.el7.centos.x86_64
--> Processing Dependency: container-storage-setup >= 0.9.0-1 for package: 2:docker-common-1.13.1-68.gitdded712.el7.centos.x86_64
--> Processing Dependency: container-selinux >= 2:2.51-1 for package: 2:docker-common-1.13.1-68.gitdded712.el7.centos.x86_64
--> Running transaction check
---> Package container-selinux.noarch 2:2.66-1.el7 will be installed
---> Package container-storage-setup.noarch 0:0.10.0-1.gitdf0dcd5.el7 will be installed
---> Package oci-register-machine.x86_64 1:0-6.git2b44233.el7 will be installed
---> Package oci-systemd-hook.x86_64 1:0.1.16-1.git05bd9a0.el7 will be installed
---> Package oci-umount.x86_64 2:2.3.3-3.gite3c9055.el7 will be installed
---> Package skopeo-containers.x86_64 1:0.1.31-1.dev.gitae64ff7.el7.centos will be installed
--> Finished Dependency Resolution
base/7/x86_64/group_gz                                                                                                                                                                                        | 166 kB  00:00:00    

Dependencies Resolved

====================================================================================================================================================================================================================================
 Package                                                     Arch                                       Version                                                                     Repository                                  Size
====================================================================================================================================================================================================================================
Installing:
 docker                                                      x86_64                                     2:1.13.1-68.gitdded712.el7.centos                                           extras                                      16 M
Installing for dependencies:
 container-selinux                                           noarch                                     2:2.66-1.el7                                                                extras                                      35 k
 container-storage-setup                                     noarch                                     0.10.0-1.gitdf0dcd5.el7                                                     extras                                      34 k
 docker-client                                               x86_64                                     2:1.13.1-68.gitdded712.el7.centos                                           extras                                     3.8 M
 docker-common                                               x86_64                                     2:1.13.1-68.gitdded712.el7.centos                                           extras                                      90 k
 oci-register-machine                                        x86_64                                     1:0-6.git2b44233.el7                                                        extras                                     1.1 M
 oci-systemd-hook                                            x86_64                                     1:0.1.16-1.git05bd9a0.el7                                                   extras                                      33 k
 oci-umount                                                  x86_64                                     2:2.3.3-3.gite3c9055.el7                                                    extras                                      32 k
 skopeo-containers                                           x86_64                                     1:0.1.31-1.dev.gitae64ff7.el7.centos                                        extras                                      17 k

Transaction Summary
====================================================================================================================================================================================================================================
Install  1 Package (+8 Dependent packages)

Total download size: 21 M
Installed size: 73 M
Is this ok [y/d/N]: y
Downloading packages:
warning: /var/cache/yum/x86_64/7/extras/packages/container-selinux-2.66-1.el7.noarch.rpm: Header V3 RSA/SHA256 Signature, key ID f4a80eb5: NOKEY                                                   ] 2.0 MB/s | 2.1 MB  00:00:09 ETA
Public key for container-selinux-2.66-1.el7.noarch.rpm is not installed
(1/9): container-selinux-2.66-1.el7.noarch.rpm                                                                                                                                                                |  35 kB  00:00:01    
(2/9): container-storage-setup-0.10.0-1.gitdf0dcd5.el7.noarch.rpm                                                                                                                                             |  34 kB  00:00:02    
(3/9): docker-common-1.13.1-68.gitdded712.el7.centos.x86_64.rpm                                                                                                                                               |  90 kB  00:00:02    
(4/9): oci-umount-2.3.3-3.gite3c9055.el7.x86_64.rpm                                                                                                                                                           |  32 kB  00:00:00    
(5/9): skopeo-containers-0.1.31-1.dev.gitae64ff7.el7.centos.x86_64.rpm                                                                                                                                        |  17 kB  00:00:00    
(6/9): docker-1.13.1-68.gitdded712.el7.centos.x86_64.rpm                                                                                                                                                      |  16 MB  00:00:04    
(7/9): oci-register-machine-0-6.git2b44233.el7.x86_64.rpm                                                                                                                                                     | 1.1 MB  00:00:02    
(8/9): oci-systemd-hook-0.1.16-1.git05bd9a0.el7.x86_64.rpm                                                                                                                                                    |  33 kB  00:00:01    
(9/9): docker-client-1.13.1-68.gitdded712.el7.centos.x86_64.rpm                                                                                                                                               | 3.8 MB  00:00:18    
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Total                                                                                                                                                                                                1.1 MB/s |  21 MB  00:00:18    
Retrieving key from file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
Importing GPG key 0xF4A80EB5:
 Userid     : "CentOS-7 Key (CentOS 7 Official Signing Key) "
 Fingerprint: 6341 ab27 53d7 8a78 a7c2 7bb1 24c6 a8a7 f4a8 0eb5
 Package    : centos-release-7-5.1804.el7.centos.x86_64 (@anaconda)
 From       : /etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
Is this ok [y/N]: y
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  Installing : 1:skopeo-containers-0.1.31-1.dev.gitae64ff7.el7.centos.x86_64                                                                                                                                                     1/9
  Installing : 2:container-selinux-2.66-1.el7.noarch                                                                                                                                                                             2/9
  Installing : 2:oci-umount-2.3.3-3.gite3c9055.el7.x86_64                                                                                                                                                                        3/9
  Installing : 1:oci-register-machine-0-6.git2b44233.el7.x86_64                                                                                                                                                                  4/9
  Installing : 1:oci-systemd-hook-0.1.16-1.git05bd9a0.el7.x86_64                                                                                                                                                                 5/9
  Installing : container-storage-setup-0.10.0-1.gitdf0dcd5.el7.noarch                                                                                                                                                            6/9
  Installing : 2:docker-common-1.13.1-68.gitdded712.el7.centos.x86_64                                                                                                                                                            7/9
  Installing : 2:docker-client-1.13.1-68.gitdded712.el7.centos.x86_64                                                                                                                                                            8/9
  Installing : 2:docker-1.13.1-68.gitdded712.el7.centos.x86_64                                                                                                                                                                   9/9
  Verifying  : container-storage-setup-0.10.0-1.gitdf0dcd5.el7.noarch                                                                                                                                                            1/9
  Verifying  : 1:oci-systemd-hook-0.1.16-1.git05bd9a0.el7.x86_64                                                                                                                                                                 2/9
  Verifying  : 1:oci-register-machine-0-6.git2b44233.el7.x86_64                                                                                                                                                                  3/9
  Verifying  : 2:oci-umount-2.3.3-3.gite3c9055.el7.x86_64                                                                                                                                                                        4/9
  Verifying  : 2:docker-client-1.13.1-68.gitdded712.el7.centos.x86_64                                                                                                                                                            5/9
  Verifying  : 2:container-selinux-2.66-1.el7.noarch                                                                                                                                                                             6/9
  Verifying  : 1:skopeo-containers-0.1.31-1.dev.gitae64ff7.el7.centos.x86_64                                                                                                                                                     7/9
  Verifying  : 2:docker-1.13.1-68.gitdded712.el7.centos.x86_64                                                                                                                                                                   8/9
  Verifying  : 2:docker-common-1.13.1-68.gitdded712.el7.centos.x86_64                                                                                                                                                            9/9

Installed:
  docker.x86_64 2:1.13.1-68.gitdded712.el7.centos                                                                                                                                                                                   

Dependency Installed:
  container-selinux.noarch 2:2.66-1.el7             container-storage-setup.noarch 0:0.10.0-1.gitdf0dcd5.el7  docker-client.x86_64 2:1.13.1-68.gitdded712.el7.centos  docker-common.x86_64 2:1.13.1-68.gitdded712.el7.centos        
  oci-register-machine.x86_64 1:0-6.git2b44233.el7  oci-systemd-hook.x86_64 1:0.1.16-1.git05bd9a0.el7         oci-umount.x86_64 2:2.3.3-3.gite3c9055.el7              skopeo-containers.x86_64 1:0.1.31-1.dev.gitae64ff7.el7.centos 

Complete!
[root@localhost ~]# docker version
Client:
 Version:         1.13.1
 API version:     1.26
 Package version: 
Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?
[root@localhost ~]# docker pull mysql
Using default tag: latest
Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?
[root@localhost ~]# docker pull mysql
Using default tag: latest
Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?
[root@localhost ~]# docker service status

Usage:    docker service COMMAND

Manage services

Options:
      --help   Print usage

Commands:
  create      Create a new service
  inspect     Display detailed information on one or more services
  logs        Fetch the logs of a service
  ls          List services
  ps          List the tasks of a service
  rm          Remove one or more services
  scale       Scale one or multiple replicated services
  update      Update a service

Run 'docker service COMMAND --help' for more information on a command.
[root@localhost ~]# service dockr status
Redirecting to /bin/systemctl status dockr.service
Unit dockr.service could not be found.
[root@localhost ~]# systemctl start docker.service
[root@localhost ~]# service dockr status
Redirecting to /bin/systemctl status dockr.service
Unit dockr.service could not be found.
[root@localhost ~]# service docker status
Redirecting to /bin/systemctl status docker.service
● docker.service - Docker Application Container Engine
   Loaded: loaded (/usr/lib/systemd/system/docker.service; disabled; vendor preset: disabled)
   Active: active (running) since Sat 2018-07-21 02:25:32 EDT; 18s ago
     Docs: http://docs.docker.com
 Main PID: 56040 (dockerd-current)
    Tasks: 15
   CGroup: /system.slice/docker.service
           ├─56040 /usr/bin/dockerd-current --add-runtime docker-runc=/usr/libexec/docker/docker-runc-current --default-runtime=docker-runc --exec-opt native.cgroupdriver=systemd --userland-proxy-path=/usr/libexec/docker/docke..
           └─56044 /usr/bin/docker-containerd-current -l unix:///var/run/docker/libcontainerd/docker-containerd.sock --metrics-interval=0 --start-timeout 2m --state-dir /var/run/docker/libcontainerd/containerd --shim docker-co..

Jul 21 02:25:29 localhost.localdomain dockerd-current[56040]: time="2018-07-21T02:25:29.226925191-04:00" level=info msg="libcontainerd: new containerd process, pid: 56044"
Jul 21 02:25:30 localhost.localdomain dockerd-current[56040]: time="2018-07-21T02:25:30.430821756-04:00" level=info msg="Graph migration to content-addressability took 0.00 seconds"
Jul 21 02:25:30 localhost.localdomain dockerd-current[56040]: time="2018-07-21T02:25:30.435792885-04:00" level=info msg="Loading containers: start."
Jul 21 02:25:30 localhost.localdomain dockerd-current[56040]: time="2018-07-21T02:25:30.664236708-04:00" level=info msg="Firewalld running: true"
Jul 21 02:25:31 localhost.localdomain dockerd-current[56040]: time="2018-07-21T02:25:31.233034900-04:00" level=info msg="Default bridge (docker0) is assigned with an IP address 172.17.0.0/16. Daemon option --bip ...ed IP address
Jul 21 02:25:31 localhost.localdomain dockerd-current[56040]: time="2018-07-21T02:25:31.896988593-04:00" level=info msg="Loading containers: done."
Jul 21 02:25:32 localhost.localdomain dockerd-current[56040]: time="2018-07-21T02:25:32.103085678-04:00" level=info msg="Daemon has completed initialization"
Jul 21 02:25:32 localhost.localdomain dockerd-current[56040]: time="2018-07-21T02:25:32.103858917-04:00" level=info msg="Docker daemon" commit="dded712/1.13.1" graphdriver=overlay2 version=1.13.1
Jul 21 02:25:32 localhost.localdomain systemd[1]: Started Docker Application Container Engine.
Jul 21 02:25:32 localhost.localdomain dockerd-current[56040]: time="2018-07-21T02:25:32.147926458-04:00" level=info msg="API listen on /var/run/docker.sock"
Hint: Some lines were ellipsized, use -l to show in full.
[root@localhost ~]# 
[root@localhost ~]# docker version
Client:
 Version:         1.13.1
 API version:     1.26
 Package version: docker-1.13.1-68.gitdded712.el7.centos.x86_64
 Go version:      go1.9.4
 Git commit:      dded712/1.13.1
 Built:           Tue Jul 17 18:34:48 2018
 OS/Arch:         linux/amd64

Server:
 Version:         1.13.1
 API version:     1.26 (minimum version 1.12)
 Package version: docker-1.13.1-68.gitdded712.el7.centos.x86_64
 Go version:      go1.9.4
 Git commit:      dded712/1.13.1
 Built:           Tue Jul 17 18:34:48 2018
 OS/Arch:         linux/amd64
 Experimental:    false
[root@localhost ~]# docker pull mysql
Using default tag: latest
Trying to pull repository docker.io/library/mysql ... 
latest: Pulling from docker.io/library/mysql
be8881be8156: Pull complete 
c3995dabd1d7: Pull complete 
9931fdda3586: Pull complete 
be38c1ab6adb: Pull complete 
0e4cc8d0eef6: Pull complete 
076630dca16e: Pull complete 
c3cdaa36d52c: Pull complete 
eaf860f635bb: Pull complete 
e169dbd2d3ba: Pull complete 
62da88586f4f: Pull complete 
e51575d56f81: Pull complete 
b08e13911038: Pull complete 
Digest: sha256:752674b529ea6d5552014630c813b8fc8eff09776481a3e81de4b11376d472cb
Status: Downloaded newer image for docker.io/mysql:latest
[root@localhost ~]# docker ps
CONTAINER ID        IMAGE               COMMAND             CREATED             STATUS              PORTS               NAMES
[root@localhost ~]# docker images
REPOSITORY          TAG                 IMAGE ID            CREATED             SIZE
docker.io/mysql     latest              f45277861b04        4 days ago          445 MB
[root@localhost ~]# docker run --name master -p 3306:3306 -e MYSQL_ROOT_PASSWORD=root -d mysql
61be0c4b15c2da60a005aed56485336164471587f39148256b9b23ce8ab70c24
[root@localhost ~]# docker ps
CONTAINER ID        IMAGE               COMMAND                  CREATED             STATUS              PORTS                    NAMES
61be0c4b15c2        mysql               "docker-entrypoint..."   11 seconds ago      Up 8 seconds        0.0.0.0:3306->3306/tcp   master
[root@localhost ~]# docker ps -a
CONTAINER ID        IMAGE               COMMAND                  CREATED             STATUS              PORTS                    NAMES
61be0c4b15c2        mysql               "docker-entrypoint..."   25 seconds ago      Up 21 seconds       0.0.0.0:3306->3306/tcp   master
[root@localhost ~]# firewall-cmd --zone=public --add-port=3306/tcp --permanent
success
[root@localhost ~]# firewall-cmd --reload
success
[root@localhost ~]# docker ps -a
CONTAINER ID        IMAGE               COMMAND                  CREATED             STATUS              PORTS                    NAMES
61be0c4b15c2        mysql               "docker-entrypoint..."   6 minutes ago       Up 6 minutes        0.0.0.0:3306->3306/tcp   master
[root@localhost ~]# mysql -u root -p
bash: mysql: command not found...
[root@localhost ~]# docker ps -a
CONTAINER ID        IMAGE               COMMAND                  CREATED             STATUS              PORTS                    NAMES
61be0c4b15c2        mysql               "docker-entrypoint..."   About an hour ago   Up About an hour    0.0.0.0:3306->3306/tcp   master
[root@localhost ~]# docker exec -it master bash
root@61be0c4b15c2:/# 
root@61be0c4b15c2:/# 
root@61be0c4b15c2:/# ls -l
total 8
drwxr-xr-x.   2 root root 4096 Jul 16 00:00 bin
drwxr-xr-x.   2 root root    6 Jun 26 12:03 boot
drwxr-xr-x.   5 root root  340 Jul 21 07:07 dev
drwxr-xr-x.   2 root root    6 Jul 17 04:16 docker-entrypoint-initdb.d
lrwxrwxrwx.   1 root root   34 Jul 17 04:17 entrypoint.sh -> usr/local/bin/docker-entrypoint.sh
drwxr-xr-x.   1 root root   66 Jul 21 07:07 etc
drwxr-xr-x.   2 root root    6 Jun 26 12:03 home
drwxr-xr-x.   1 root root   30 Jul 16 00:00 lib
drwxr-xr-x.   2 root root   34 Jul 16 00:00 lib64
drwxr-xr-x.   2 root root    6 Jul 16 00:00 media
drwxr-xr-x.   2 root root    6 Jul 16 00:00 mnt
drwxr-xr-x.   2 root root    6 Jul 16 00:00 opt
dr-xr-xr-x. 229 root root    0 Jul 21 07:07 proc
drwx------.   1 root root   24 Jul 17 04:16 root
drwxr-xr-x.   1 root root   35 Jul 21 07:07 run
drwxr-xr-x.   2 root root 4096 Jul 16 00:00 sbin
drwxr-xr-x.   2 root root    6 Jul 16 00:00 srv
dr-xr-xr-x.  13 root root    0 Jul 21 05:51 sys
drwxrwxrwt.   1 root root    6 Jul 21 07:07 tmp
drwxr-xr-x.   1 root root   19 Jul 16 00:00 usr
drwxr-xr-x.   1 root root   41 Jul 16 00:00 var
root@61be0c4b15c2:/# mysql -u root -p
Enter password: 
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 15
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> 
mysql> 
mysql> show databases;
+--------------------+
| Database           |
+--------------------+
| information_schema |
| mysql              |
| performance_schema |
| sys                |
+--------------------+
4 rows in set (0.09 sec)

mysql> show tables;
ERROR 1046 (3D000): No database selected
mysql> show tables;
ERROR 1046 (3D000): No database selected
mysql> use mysql; 
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A

Database changed
mysql> show tables;
+---------------------------+
| Tables_in_mysql           |
+---------------------------+
| columns_priv              |
| component                 |
| db                        |
| default_roles             |
| engine_cost               |
| func                      |
| general_log               |
| global_grants             |
| gtid_executed             |
| help_category             |
| help_keyword              |
| help_relation             |
| help_topic                |
| innodb_index_stats        |
| innodb_table_stats        |
| password_history          |
| plugin                    |
| procs_priv                |
| proxies_priv              |
| role_edges                |
| server_cost               |
| servers                   |
| slave_master_info         |
| slave_relay_log_info      |
| slave_worker_info         |
| slow_log                  |
| tables_priv               |
| time_zone                 |
| time_zone_leap_second     |
| time_zone_name            |
| time_zone_transition      |
| time_zone_transition_type |
| user                      |
+---------------------------+
33 rows in set (0.01 sec)

mysql> select user, host, plugin, authentication_string from user\G; 
*************************** 1. row ***************************
                 user: root
                 host: %
               plugin: caching_sha2_password
authentication_string: $A$005$    F    'E@
                                           x-0%xZyJxg9SG296/bWZNHR49CW6dJkpTLJA1xSIK/1jepZ7Q04
*************************** 2. row ***************************
                 user: mysql.infoschema
                 host: localhost
               plugin: mysql_native_password
authentication_string: *THISISNOTAVALIDPASSWORDTHATCANBEUSEDHERE
*************************** 3. row ***************************
                 user: mysql.session
                 host: localhost
               plugin: mysql_native_password
authentication_string: *THISISNOTAVALIDPASSWORDTHATCANBEUSEDHERE
*************************** 4. row ***************************
                 user: mysql.sys
                 host: localhost
               plugin: mysql_native_password
authentication_string: *THISISNOTAVALIDPASSWORDTHATCANBEUSEDHERE
*************************** 5. row ***************************
                 user: root
                 host: localhost
               plugin: caching_sha2_password
authentication_string: $A$005$4=%lo1
                                    +4{A    OQ7#1hECWwBuF90oNMdWd5tHSzhhd9b/I3oEJiugXkH8hl5c9
5 rows in set (0.01 sec)

ERROR: 
No query specified

mysql> CREATE USER 'test'@'%' IDENTIFIED WITH mysql_native_password BY 'test'; 
Query OK, 0 rows affected (0.17 sec)

mysql> 
Socket error Event: 32 Error: 10053.
Connection closing...Socket close.

Connection closed by foreign host.

Disconnected from remote host(v-192.168.67.133 - 副本 (2)) at 16:48:15.

Failed to Connect to MySQL at ip:3306 with user root 
Authentication plugin 'caching_sha2_password' cannot be loaded: dlopen(/usr/local/mysql/lib/plugin/caching_sha2_password.so, 2): image not found 

参考博客

http://binary-space.iteye.com/blog/2412769

http://binary-space.iteye.com/blog/2412769

[root@localhost ~]# docker exec  -it master bash
root@61be0c4b15c2:/# mysql -u root -p 
Enter password: 
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 22
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> 
mysql> ALTER USER 'root'@'%' IDENTIFIED WITH mysql_native_password BY 'root'; 
Query OK, 0 rows affected (0.12 sec)

mysql> 
 

docker 安装mysql,远程登录问题_第1张图片

这回客户端链接成功了。

docker 安装mysql,远程登录问题_第2张图片

你可能感兴趣的:(mysql,docker)