目前我在docker swarm工作, 我在裸机服务器上制作了带有docker swarm的2节点集群。 我试图在每个节点中运行单个容器,它们正在运行。但是当我写docker-compose.yml文件来运行副本时。它会出错,我的 docker-compose.yml 就在这里。
version: "3"
services:
web:
# replace username/repo:tag with your name and image details
image: brainplow/shopnroar:latest
deploy:
replicas: 2
restart_policy:
condition: on-failure
resources:
limits:
cpus: "0.1"
memory: 50M
ports:
- "8000:8080"
networks:
- webnet
web-dhaar:
# replace username/repo:tag with your name and image details
image: brainplow/dhaar:latest
deploy:
replicas: 2
restart_policy:
condition: on-failure
resources:
limits:
cpus: "0.1"
memory: 50M
ports:
- "9090:9090"
networks:
- webnet
visualizer:
image: dockersamples/visualizer:stable
ports:
- "8010:8080"
volumes:
- "/var/run/docker.sock:/var/run/docker.sock"
deploy:
placement:
constraints: [node.role == manager]
networks:
- webnet
redis:
image: redis
ports:
- "6379:6379"
volumes:
- /home/docker/data:/data
deploy:
placement:
constraints: [node.role == manager]
command: redis-server --appendonly yes
networks:
- webnet
networks:
webnet:
当我运行docker service ls
时,它会提供以下内容,
ID NAME MODE REPLICAS IMAGE PORTS
h6irzq0swdat getstartedlab_redis replicated 0/1 redis:latest *:6379->6379/tcp
tuchpcxd159x getstartedlab_visualizer replicated 0/1 dockersamples/visualizer:stable *:8010->8080/tcp
mt5jxxfty0om getstartedlab_web replicated 0/2 brainplow/shopnroar:latest *:8000->8080/tcp
igz1ceqtawkk getstartedlab_web-dhaar replicated 0/2 brainplow/dhaar:latest *:9090->9090/tcp
hdya9obuk7ok redis replicated 0/5 myservice:latest
当我运行docker service ps igz1ceqtawkk
时它给了我这个错误,
zg7ostkj1ycn \_ redis.4 myservice:latest Masternode Shutdown Rejected 4 minutes ago "No such image: myservice:late…"
xxscungxgmbv \_ redis.4 myservice:latest Slavenode Shutdown Rejected 4 minutes ago "No such image: myservice:late…"
6i5qq5msn6ig redis.5 myservice:latest Masternode Ready Rejected 2 seconds ago "No such image: myservice:late…"
zsvxwm9nsjj6 \_ redis.5 myservice:latest Masternode Shutdown Rejected 32 seconds ago "No such image: myservice:late…"
yshbkh62eb7x \_ redis.5 myservice:latest Slavenode Shutdown Rejected about a minute ago "No such image: myservice:late…"
zat104nz0evk \_ redis.5 myservice:latest Slavenode Shutdown Rejected 3 minutes ago "No such image: myservice:late…"
zd4rcb9eeqbb \_ redis.5 myservice:latest Slavenode Shutdown Rejected 3 minutes ago "No such image: myservice:late…"
有时这个
zy72uf810mka \_ getstartedlab_web.5 brainplow/shopnroar:latest Masternode Shutdown Failed 21 minutes ago "starting container failed: su…"
zzpe0lwoe7cd \_ getstartedlab_web.5 brainplow/shopnroar:latest Masternode Shutdown Failed 30 minutes ago "starting container failed: su…"
zt3eu0jb2uou \_ getstartedlab_web.5 brainplow/shopnroar:latest Slavenode Shutdown Failed 41 minutes ago "starting container failed: su…"
zxesxvq2vumv \_ getstartedlab_web.5 brainplow/shopnroar:latest Masternode Shutdown Failed 2 hours ago "starting container failed: su…"
任何人都可以告诉我它为什么会发生。
这是我的docker info
Containers: 2430
Running: 0
Paused: 0
Stopped: 2430
Images: 5
Server Version: 17.09.0-ce
Storage Driver: overlay2
Backing Filesystem: extfs
Supports d_type: true
Native Overlay Diff: true
Logging Driver: json-file
Cgroup Driver: cgroupfs
Plugins:
Volume: local
Network: bridge host macvlan null overlay
Log: awslogs fluentd gcplogs gelf journald json-file logentries splunk syslog
Swarm: active
NodeID: wf9o88zy9w4xek011esw9oaa5
Is Manager: true
ClusterID: at6z6315v8d8zs43u1u3dqqca
Managers: 1
Nodes: 2
Orchestration:
Task History Retention Limit: 5
Raft:
Snapshot Interval: 10000
Number of Old Snapshots to Retain: 0
Heartbeat Tick: 1
Election Tick: 3
Dispatcher:
Heartbeat Period: 5 seconds
CA Configuration:
Expiry Duration: 3 months
Force Rotate: 0
Autolock Managers: false
Root Rotation In Progress: false
Node Address: 158.69.23.109
Manager Addresses:
158.69.23.109:2377
Runtimes: runc
Default Runtime: runc
Init Binary: docker-init
containerd version: 06b9cb35161009dcb7123345749fef02f7cea8e0
runc version: 3f2f8b84a77f73d38244dd690525642a72156c64
init version: 949e6fa
Security Options:
seccomp
Profile: default
Kernel Version: 4.9.33-mod-std-ipv6-64
Operating System: Ubuntu 16.04.3 LTS
OSType: linux
Architecture: x86_64
CPUs: 8
Total Memory: 31.04GiB
Name: Masternode
ID: 3GY6:RP6D:W3SU:FAJV:ZOJP:THFX:TYDF:UZKB:3FJN:WJKC:I23H:MBHO
Docker Root Dir: /var/lib/docker
Debug Mode (client): false
Debug Mode (server): false
Username: brainplow
Registry: https://index.docker.io/v1/
Experimental: false
Insecure Registries:
127.0.0.0/8
Live Restore Enabled: false
WARNING: No cpu cfs quota support
WARNING: No cpu cfs period support
和
docker node ls
ID HOSTNAME STATUS AVAILABILITY MANAGER STATUS
wf9o88zy9w4xek011esw9oaa5 * Masternode Ready Active Leader
n3n38nos3kzcq4g4gl8l0s48c Slavenode Ready Active
任何人都可以告诉我为什么我的容器没有在服务中运行。我坚持下去了。
和我的docker version
Client:
Version: 17.09.0-ce
API version: 1.32
Go version: go1.8.3
Git commit: afdb6d4
Built: Tue Sep 26 22:42:18 2017
OS/Arch: linux/amd64
Server:
Version: 17.09.0-ce
API version: 1.32 (minimum version 1.12)
Go version: go1.8.3
Git commit: afdb6d4
Built: Tue Sep 26 22:40:56 2017
OS/Arch: linux/amd64
Experimental: false
提前致谢。真的需要帮助。
答案 0 :(得分:0)
问题现在解决了。这是由于核心版本。我正在研究裸机云,我在上面安装了Ubuntu 16.04。但我忘了安装这个版本附带的核心。
用自己的内核重新安装Ubuntu之后,问题就解决了。