Docker环境编译时的两个错误记录

Posted kevingrace

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Docker环境编译时的两个错误记录相关的知识,希望对你有一定的参考价值。

 

1)报错一
docker-compose -f compose/app.yaml -f compose/backend.yaml -f compose/proxy.yaml build peatio barong
ERROR: Couldn‘t connect to Docker daemon at http://localhost:4243 - is it running?

If it‘s at a non-standard location, specify the URL with the DOCKER_HOST environment variable.
make: *** [build] Error 1

解决办法:

1)查看配置文件
[[email protected] ~]# systemctl show docker | grep FragmentPath=
FragmentPath=/usr/lib/systemd/system/docker.service

然后修改/lib/systemd/system/docker.service文件
[[email protected] ~]# cp /lib/systemd/system/docker.service /lib/systemd/system/docker.service.bak
[[email protected] ~]# vim /lib/systemd/system/docker.service
.......
ExecStart=/usr/bin/dockerd -H unix:///var/run/docker.sock -H tcp://0.0.0.0:4243                  #添加这一行
#ExecStart=/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/docker-proxy-current           --seccomp-profile=/etc/docker/seccomp.json           $OPTIONS           $DOCKER_STORAGE_OPTIONS           $DOCKER_NETWORK_OPTIONS           $ADD_REGISTRY           $BLOCK_REGISTRY           $INSECURE_REGISTRY     $REGISTRIES

2)修改/etc/default/docker文件
[[email protected] ~]# cp /etc/default/docker /etc/default/docker.bak
[[email protected] ~]# vim /etc/sysconfig/docker
......
DOCKER_OPTS="-H tcp://localhost:4243 -H unix:///var/run/docker.sock"          #添加这一行

3)DOCKER_HOST的环境变量设置
[[email protected] ~]# vim ~/.bashrc 
........
export DOCKER_HOST=tcp://localhost:4243

4)重启docker服务
[[email protected] ~]# systemctl daemon-reload
[[email protected] ~]# systemctl restart docker

5)检查发现4243端口已启动
[[email protected] ~]# netstat -ant
.......
tcp6       0      0 :::4243                 :::*                    LISTEN     
[[email protected] ~]# lsof -i:4243
COMMAND     PID USER   FD   TYPE DEVICE SIZE/OFF NODE NAME
dockerd-c 15400 root    6u  IPv6  59175      0t0  TCP *:4243 (LISTEN)

2)报错二
ERROR: Service ‘****‘ failed to build: shim error: docker-runc not installed on system

解决办法

[[email protected]er-server ~]# cd /usr/libexec/docker/
[[email protected] ~]# ll
total 7384
-rwxr-xr-x 1 root root  820472 Mar  8 01:07 docker-init-current
-rwxr-xr-x 1 root root 1687304 Mar  8 01:07 docker-proxy-current
-rwxr-xr-x 1 root root 5047808 Mar  8 01:07 docker-runc-current
[[email protected] ~]# ln -s docker-runc-current docker-runc
[[email protected] ~]# ll
total 7384
-rwxr-xr-x 1 root root  820472 Mar  8 01:07 docker-init-current
-rwxr-xr-x 1 root root 1687304 Mar  8 01:07 docker-proxy-current
lrwxrwxrwx 1 root root      19 May 12 01:07 docker-runc -> docker-runc-current
-rwxr-xr-x 1 root root 5047808 Mar  8 01:07 docker-runc-current

以上是关于Docker环境编译时的两个错误记录的主要内容,如果未能解决你的问题,请参考以下文章

错误记录Android Studio 编译报错 ( Could not determine java version from ‘11.0.8‘. | Android Studio 降级 )(代码片段

docker随笔:交叉编译工具链 docker镜像的制作

docker随笔:交叉编译工具链 docker镜像的制作

编译 C 代码时的 Makefile 错误

Docker删除报错:Error response from daemon: conflict: unable to delete 08b152afcfae (must be forced)(代码片段

查看package编译时的错误信息及重新编译