yum install docker-ce [root@localhost ~]# docker version Client: Docker Engine - Community Version: 20.10.12 API version: 1.41 Go version: go1.16.12 Git commit: e91ed57 Built: Mon Dec 13 11:45:41 2021 OS/Arch: linux/amd64 Context: default Experimental: true Server: Docker Engine - Community Engine: Version: 20.10.12 API version: 1.41 (minimum version 1.12) Go version: go1.16.12 Git commit: 459d0df Built: Mon Dec 13 11:44:05 2021 OS/Arch: linux/amd64 Experimental: false containerd: Version: 1.4.12 GitCommit: 7b11cfaabd73bb80907dd23182b9347b4245eb5d runc: Version: 1.0.2 GitCommit: v1.0.2-0-g52b36a2 docker-init: Version: 0.19.0 GitCommit: de40ad0二、开通Docker的远程Api端口2375
# 1、在ExecStart下,增加 -H tcp://0.0.0.0:2375 vi /lib/systemd/system/docker.service [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 fd:// -H tcp://0.0.0.0:2375 --containerd=/run/containerd/containerd.sock ExecReload=/bin/kill -s HUP $MAINPID TimeoutSec=0 RestartSec=2 Restart=always # 2、保存,然后输入以下命令,重新加载配置和重启 systemctl daemon-reload systemctl restart docker三、开放防火墙端口
firewall-cmd --add-port=2375/tcp firewall-cmd --add-port=2375/tcp --permanent四、配置docker_host环境变量
注意:IDE工具如果早于环境变量配置前打开了;最好在配置环境变量后,将IDE关闭重新打开。不然maven_docker连接地址还是本地的127.0.0.1:2375
五、使用Maven构建Docker镜像执行如图所示,进行maven打包:
# maven打包成功后即可见到镜像 [root@localhost ~]# docker images REPOSITORY TAG IMAGE ID CREATED SIZE ms-sailfish/register-center-server latest 4a717ca6f02f 17 minutes ago 735MB ms-sailfish/register-center-server v0.0.1 4a717ca6f02f 17 minutes ago 735MB java latest d23bdf5b1b1b 4 years ago 643MB
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)