zoukankan      html  css  js  c++  java
  • maven构建docker镜像异常

    由于没有配置ip+2375端口,导致每次跑的时候,都是连接本地的,一直会报错

    [ERROR] Failed to execute goal com.spotify:docker-maven-plugin:0.4.5:build (server) on project web-service: Exception caught: java.util.concurrent.ExecutionException: com.spotify.docker.client.shaded.javax.ws.rs.ProcessingException: org.apache.http.conn.HttpHostConnectException: Connect to localhost:2375 [localhost/127.0.0.1, localhost/0:0:0:0:0:0:0:1, localhost/fe80:0:0:0:0:0:0:1%1] failed: Connection refused -> [Help 1]

    研究了几个小时,终于解决了。

    客户端:

    加上  -H tcp://0.0.0.0:2375
    [root@topcheer system]# cat docker.service
    [Unit]
    Description=Docker Application Container Engine
    Documentation=https://docs.docker.com
    BindsTo=containerd.service
    After=network-online.target firewalld.service containerd.service
    Wants=network-online.target
    Requires=docker.socket
    
    [Service]
    Type=notify
    # the default is not to use systemd for cgroups because the delegate issues still
    # exists and systemd currently does not support the cgroup feature set required
    # for containers run by docker
    ExecStart=/usr/bin/dockerd -H tcp://0.0.0.0:2375  -H fd:// --containerd=/run/containerd/containerd.sock
    ExecReload=/bin/kill -s HUP $MAINPID
    TimeoutSec=0
    RestartSec=2
    Restart=always
    
    # Note that StartLimit* options were moved from "Service" to "Unit" in systemd 229.
    # Both the old, and new location are accepted by systemd 229 and up, so using the old location
    # to make them work for either version of systemd.
    StartLimitBurst=3
    
    # Note that StartLimitInterval was renamed to StartLimitIntervalSec in systemd 230.
    # Both the old, and new name are accepted by systemd 230 and up, so using the old name to make
    # this option work for either version of systemd.
    StartLimitInterval=60s
    
    # Having non-zero Limit*s causes performance problems due to accounting overhead
    # in the kernel. We recommend using cgroups to do container-local accounting.
    LimitNOFILE=infinity
    LimitNPROC=infinity
    LimitCORE=infinity
    
    # Comment TasksMax if your systemd version does not support it.
    # Only systemd 226 and above support this option.
    TasksMax=infinity
    
    # set delegate yes so that systemd does not reset the cgroups of docker containers
    Delegate=yes
    
    # kill only the docker process, not all processes in the cgroup
    KillMode=process
    
    [Install]
    WantedBy=multi-user.target
    [root@topcheer system]# pwd
    /usr/lib/systemd/system
    [root@topcheer system]#

    重启docker,会发现2375起起来了

    [root@topcheer system]# lsof -i:2375
    COMMAND   PID USER   FD   TYPE DEVICE SIZE/OFF NODE NAME
    dockerd 21337 root    7u  IPv6 128286      0t0  TCP *:2375 (LISTEN)
    [root@topcheer system]#

    客户端:

    2种选择

    要不配置环境变量:

     要不在pom.xml添加

    <dockerHost>http://192.168.180.105:2375</dockerHost>

    测试:

    [INFO] Pushing 192.168.180.105:1180/topcheer/docker:1.0.2
    The push refers to repository [192.168.180.105:1180/topcheer/docker]
    75db466d4814: Preparing 
    82128b555bad: Preparing 
    35c20f26d188: Preparing 
    c3fe59dd9556: Preparing 
    6ed1a81ba5b6: Preparing 
    a3483ce177ce: Preparing 
    ce6c8756685b: Preparing 
    30339f20ced0: Preparing 
    0eb22bfb707d: Preparing 
    a2ae92ffcd29: Preparing 
    
    a3483ce177ce: Waiting 
    
    ce6c8756685b: Waiting 
    
    30339f20ced0: Waiting 
    
    0eb22bfb707d: Waiting 
    
    a2ae92ffcd29: Waiting 
    
    35c20f26d188: Layer already exists 
    
    c3fe59dd9556: Layer already exists 
    
    6ed1a81ba5b6: Layer already exists 
    
    75db466d4814: Layer already exists 
    
    82128b555bad: Layer already exists 
    
    0eb22bfb707d: Layer already exists 
    
    a3483ce177ce: Layer already exists 
    
    a2ae92ffcd29: Layer already exists 
    
    ce6c8756685b: Layer already exists 
    
    30339f20ced0: Layer already exists 
    1.0.2: digest: sha256:65b55efa410146d044fa6feba6d9456f13f601f83a2ef73c91e0b0b7a8efc94c size: 2424
    null: null 
    [INFO] ------------------------------------------------------------------------
    [INFO] BUILD SUCCESS
    [INFO] ------------------------------------------------------------------------
    [INFO] Total time: 40.289 s
    [INFO] Finished at: 2019-11-05T18:43:23+08:00
    [INFO] ----------------------------------------------
  • 相关阅读:
    mongodb 创建auto increment 自增函数
    QT通过IP地址定位地址(用get方法取数据)
    VC程序快速删除自己(可能做升级程序的时候有用)
    让程序出现在控制面板(写注册表)
    亲测VS2010纯静态编译QT4.8.0,实现VS2010编译调试Qt程序,QtCreator静态发布程序(图文并茂,非常详细) good
    Qt configure 参数不完全说明
    C语言和C++篇
    C#开源实现MJPEG流传输
    前端EASYUI的简化调用
    .NET Mvc Razor
  • 原文地址:https://www.cnblogs.com/dalianpai/p/11800892.html
Copyright © 2011-2022 走看看