开发环境
goland windows10
Docker centos IP:123.57.43.91
操作原理及流程
goland通过tcp/8080(应该选取2375,登录阿里云开启这个端口,这里临时采用)端口与docker-host通信, 发送docker指令,然后让linux执行,通过docker指令,创建image,运行container,实现host与container之间目录挂载,端口映射等操作。然后使用SFTP进行代码的上传 。
配置端口和重启
sudo vim /lib/systemd/system/docker.service
第18行
1 [Unit]
2 Description=Docker Application Container Engine
3 Documentation=http://docs.docker.com
4 After=network.target
5 Wants=docker-storage-setup.service
6 Requires=docker-cleanup.timer
7
8 [Service]
9 Type=notify
10 NotifyAccess=main
11 EnvironmentFile=-/run/containers/registries.conf
12 EnvironmentFile=-/etc/sysconfig/docker
13 EnvironmentFile=-/etc/sysconfig/docker-storage
14 EnvironmentFile=-/etc/sysconfig/docker-network
15 Environment=GOTRACEBACK=crash
16 Environment=DOCKER_HTTP_HOST_COMPAT=1
17 Environment=PATH=/usr/libexec/docker:/usr/bin:/usr/sbin
18 ExecStart=/usr/bin/dockerd-current -H tcp://0.0.0.0:8080 -H unix://var/run/docker.sock\
19 --add-runtime docker-runc=/usr/libexec/docker/docker-runc-current \
20 --default-runtime=docker-runc \
21 --exec-opt native.cgroupdriver=systemd \
22 --userland-proxy-path=/usr/libexec/docker/docker-proxy-current \
23 --init-path=/usr/libexec/docker/docker-init-current \
24 --seccomp-profile=/etc/docker/seccomp.json \
25 $OPTIONS \
26 $DOCKER_STORAGE_OPTIONS \
27 $DOCKER_NETWORK_OPTIONS \
28 $ADD_REGISTRY \
29 $BLOCK_REGISTRY \
30 $INSECURE_REGISTRY \
31 $REGISTRIES
32 ExecReload=/bin/kill -s HUP $MAINPID
重启服务
systemctl daemon-reload
sudo service docker restart
启动Docker
连接Docker服务器,标志:Connection successful
配置Docker run
- Image ID :附录I, 图1
- Container name: 指定容器名称
- Bind Ports:ip
- Bind mounts: Docker文件存储位置
- –privileged: 挂载权限
SFTP连接
附录
图1
进行选取name的时候用的是Value一列的值