RHEL7 docker启动出错了 systemctl start docker.service 小白求教docker centos7里面的service命令

docker\u542f\u52a8\u51fa\u9519

1. \u5b89\u88c5 Docker\u5728\u5f00\u59cb\u524d\uff0c\u6211\u4eec\u9996\u5148\u5f97\u786e\u4fdd\u5728Linux\u4e3b\u673a\u4e2d\u5df2\u7ecf\u5b89\u88c5\u4e86Docker\u3002\u8fd9\u91cc\uff0c\u6211\u8fd0\u884c\u7684\u662fCentOS 7 \u4e3b\u673a\uff0c\u6211\u4eec\u5c06\u8fd0\u884cyum\u7ba1\u7406\u5668\u548c\u4e0b\u9762\u7684\u547d\u4ee4\u6765\u5b89\u88c5Docker\u3002# yum install docker# systemctl restart docker.service2. \u521b\u5efa Dockerfile\u73b0\u5728\uff0cDocker\u5b88\u62a4\u8fdb\u7a0b\u5df2\u7ecf\u5728\u8fd0\u884c\u4e2d\u4e86\uff0c\u6211\u4eec\u73b0\u5728\u51c6\u5907\u521b\u5efa\u81ea\u5df1\u7684Firefox Docker\u5bb9\u5668\u3002\u6211\u4eec\u8981\u521b\u5efa\u4e00\u4e2aDockerfile\uff0c\u5728\u5176\u4e2d\u6211\u4eec\u8981\u8f93\u5165\u9700\u8981\u7684\u914d\u7f6e\u6765\u521b\u5efa\u4e00\u4e2a\u53ef\u4ee5\u5de5\u4f5c\u7684Firefox\u5bb9\u5668\u3002\u4e3a\u4e86\u8fd0\u884c Docker \u955c\u50cf\u6211\u4eec\u9700\u8981\u4f7f\u7528\u6700\u65b0\u7248\u672c\u7684CentOS\u3002\u8981\u521b\u5efa Docker \u955c\u50cf\uff0c\u6211\u4eec\u9700\u8981\u7528\u6587\u672c\u7f16\u8f91\u5668\u521b\u5efa\u4e00\u4e2a\u540d\u4e3aDockerfile\u7684\u6587\u4ef6\u3002# nano Dockerfile

CentOS 7 \u4e2d Docker \u7684\u5b89\u88c5
Docker \u8f6f\u4ef6\u5305\u5df2\u7ecf\u5305\u62ec\u5728\u9ed8\u8ba4\u7684 CentOS-Extras \u8f6f\u4ef6\u6e90\u91cc\u3002\u56e0\u6b64\u60f3\u8981\u5b89\u88c5 docker\uff0c\u53ea\u9700\u8981\u8fd0\u884c\u4e0b\u9762\u7684 yum \u547d\u4ee4\uff1a
[root@localhost ~]# yum install docker

\u542f\u52a8 Docker \u670d\u52a1
\u5b89\u88c5\u5b8c\u6210\u540e\uff0c\u4f7f\u7528\u4e0b\u9762\u7684\u547d\u4ee4\u6765\u542f\u52a8 docker \u670d\u52a1\uff0c\u5e76\u5c06\u5176\u8bbe\u7f6e\u4e3a\u5f00\u673a\u542f\u52a8\uff1a
[root@localhost ~]# service docker start[root@localhost ~]# chkconfig docker on

\uff08LCTT \u8bd1\u6ce8\uff1a\u6b64\u5904\u91c7\u7528\u4e86\u65e7\u5f0f\u7684 sysv \u8bed\u6cd5\uff0c\u5982\u91c7\u7528CentOS 7\u4e2d\u652f\u6301\u7684\u65b0\u5f0f systemd \u8bed\u6cd5\uff0c\u5982\u4e0b\uff1a
[root@localhost ~]# systemctl start docker.service[root@localhost ~]# systemctl enable docker.service

\uff09
\u4e0b\u8f7d\u5b98\u65b9\u7684 CentOS \u955c\u50cf\u5230\u672c\u5730
[root@localhost ~]# docker pull centosPulling repository centos192178b11d36: Download complete 70441cac1ed5: Download complete ae0c2d0bdc10: Download complete 511136ea3c5a: Download complete 5b12ef8fd570: Download complete

\u786e\u8ba4 CentOS \u955c\u50cf\u5df2\u7ecf\u88ab\u83b7\u53d6\uff1a
[root@localhost ~]# docker images centosREPOSITORY TAG IMAGE ID CREATED VIRTUAL SIZEcentos centos5 192178b11d36 2 weeks ago 466.9 MBcentos centos6 70441cac1ed5 2 weeks ago 215.8 MBcentos centos7 ae0c2d0bdc10 2 weeks ago 224 MBcentos latest ae0c2d0bdc10 2 weeks ago 224 MB

\u8fd0\u884c\u4e00\u4e2a Docker \u5bb9\u5668\uff1a
[root@localhost ~]# docker run -i -t centos /bin/bash[root@dbf66395436d /]#

\u6211\u4eec\u53ef\u4ee5\u770b\u5230\uff0cCentOS \u5bb9\u5668\u5df2\u7ecf\u88ab\u542f\u52a8\uff0c\u5e76\u4e14\u6211\u4eec\u5f97\u5230\u4e86 bash \u63d0\u793a\u7b26\u3002\u5728 docker \u547d\u4ee4\u4e2d\u6211\u4eec\u4f7f\u7528\u4e86 \u201c-i \u6355\u83b7\u6807\u51c6\u8f93\u5165\u8f93\u51fa\u201d\u548c \u201c-t \u5206\u914d\u4e00\u4e2a\u7ec8\u7aef\u6216\u63a7\u5236\u53f0\u201d\u9009\u9879\u3002\u82e5\u8981\u65ad\u5f00\u4e0e\u5bb9\u5668\u7684\u8fde\u63a5\uff0c\u8f93\u5165 exit\u3002
[root@cd05639b3f5c /]# cat /etc/redhat-release CentOS Linux release 7.0.1406 (Core) [root@cd05639b3f5c /]# exitexit[root@localhost ~]#

\u6211\u4eec\u8fd8\u53ef\u4ee5\u641c\u7d22\u57fa\u4e8e Fedora \u548c Ubuntu \u64cd\u4f5c\u7cfb\u7edf\u7684\u5bb9\u5668\u3002
[root@localhost ~]# docker search ubuntu[root@localhost ~]# docker search fedora

\u663e\u793a\u5f53\u524d\u6b63\u5728\u8fd0\u884c\u5bb9\u5668\u7684\u5217\u8868

使用以下方法
[root@apptest ~]# curl -fsSL https://get.docker.com/ | sh
+ sh -c 'sleep 3; yum -y -q install docker-engine'
警告:/var/cache/yum/x86_64/7/docker-main-repo/packages/docker-engine-selinux-1.10.2-1.el7.centos.noarch.rpm: 头V4 RSA/SHA512 Signature, 密钥 ID 2c52609d: NOKEY
docker-engine-selinux-1.10.2-1.el7.centos.noarch.rpm 的公钥尚未安装
导入 GPG key 0x2C52609D:
用户ID : "Docker Release Tool (releasedocker) <[email protected]>"
指纹 : 5811 8e89 f3a9 1289 7c07 0adb f762 2157 2c52 609d
来自 : https://yum.dockerproject.org/gpg
setsebool: SELinux is disabled.
+ sh -c 'docker version'
Client:
Version: 1.10.2
API version: 1.22
Go version: go1.5.3
Git commit: c3959b1
Built: Mon Feb 22 16:16:33 2016
OS/Arch: linux/amd64
Cannot connect to the Docker daemon. Is the docker daemon running on this host?
If you would like to use Docker as a non-root user, you should now consider
adding your user to the "docker" group with something like:
sudo usermod -aG docker your-user
Remember that you will have to log out and back in for this to take effect!
[root@apptest ~]# service docker start
Redirecting to /bin/systemctl start docker.service
[root@apptest ~]# docker images
REPOSITORY TAG IMAGE ID CREATED SIZE

扩展阅读:www.sony.com.cn ... 安卓kodi 17.5中文版 ... docker启动容器如何能进入 ... docker 官网 ... docker启动redis ... docker 启动镜像 ... docker启动服务 ... docker 容器自启动 ... docker启动所有容器 ...

本站交流只代表网友个人观点,与本站立场无关
欢迎反馈与建议,请联系电邮
2024© 车视网