docker - 来自守护程序的错误响应:rpc错误:code = 2 desc = name与现有对象

时间:2017-02-12 18:56:35

标签: docker redis microservices boot2docker docker-swarm

创建泊坞窗服务时,我面临以下错误。错误回复from daemon: rpc error: code = 2 desc = name conflicts with an existing object

步骤

docker-machine create --driver virtualbox swarm-1
docker-machine create --driver virtualbox swarm-2
docker-machine create --driver virtualbox swarm-3

eval $(docker-machine env swarm-1)
docker swarm init --advertise-addr $(docker-machine ip swarm-1)

docker-machine ssh swarm-2
docker swarm join <token> and IP

docker-machine ssh swarm-3
docker swarm join <token> and IP

docker node ls
ID                           HOSTNAME  STATUS  AVAILABILITY  MANAGER STATUS
hdip26vwi9xvr131u1rr7yeia    swarm-3   Ready   Active        
v7e56wf0j7fhkarnqsp5c32qo    swarm-2   Ready   Active        
yjv3r4r4ls4qx47jnm0yov06u *  swarm-1   Ready   Active        Leader

docker network create --driver overlay webnet

docker service create --name redisdb --network webnet --replicas 1 redis

Error response from daemon: rpc error: code = 2 desc = name conflicts with an existing object

我试过

docker service create --name redisdb --network webnet --replicas 1 redis:alpine

docker service create --name redisdb --network webnet --replicas 1 redis:alpine

docker service create --name redisdb --network webnet --replicas 1 
rlesouef/alpine-redis

没有工作.. 有什么建议吗?

添加其他信息

docker info
Containers: 0
 Running: 0
 Paused: 0
 Stopped: 0
Images: 0
Server Version: 1.13.1
Storage Driver: aufs
 Root Dir: /mnt/sda1/var/lib/docker/aufs
 Backing Filesystem: extfs
 Dirs: 0
 Dirperm1 Supported: true
Logging Driver: json-file
Cgroup Driver: cgroupfs
Plugins: 
 Volume: local
 Network: bridge host macvlan null overlay
Swarm: active
 NodeID: p5bao7gz89hghllnykw8phaek
 Is Manager: true
 ClusterID: rn5xgfioygwp1b91gfm5znd7v
 Managers: 1
 Nodes: 3
 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
 Node Address: 192.168.99.100
 Manager Addresses:
  192.168.99.100:2377
Runtimes: runc
Default Runtime: runc
Init Binary: docker-init
containerd version: aa8187dbd3b7ad67d8e5e3a15115d3eef43a7ed1
runc version: 9df8b306d01f59d3a8029be411de015b7304dd8f
init version: 949e6fa
Security Options:
 seccomp
  Profile: default
Kernel Version: 4.4.47-boot2docker
Operating System: Boot2Docker 1.13.1 (TCL 7.2); HEAD : b7f6033 - Wed Feb  8 20:31:48 UTC 2017
OSType: linux
Architecture: x86_64
CPUs: 1
Total Memory: 995.8 MiB
Name: swarm-1
ID: JGLZ:XY2M:TTZX:DIT7:QCMX:DCNO:6BR4:IJVM:HOQ7:N3Y6:YGNG:LBD4
Docker Root Dir: /mnt/sda1/var/lib/docker
Debug Mode (client): false
Debug Mode (server): true
 File Descriptors: 41
 Goroutines: 191
 System Time: 2017-02-13T18:28:57.184074564Z
 EventsListeners: 0
Username: pranaysankpal
Registry: https://index.docker.io/v1/
Labels:
 provider=virtualbox
Experimental: false
Insecure Registries:
 127.0.0.0/8
Live Restore Enabled: false

请建议。

1 个答案:

答案 0 :(得分:0)

我遇到了同样的问题。 通过以下方法解决了该问题:

1)通过运行sudo docker service ls获取服务列表。 您应该看到正在尝试创建的服务(redisdb)

2)取得列表中redisdb服务旁边显示的ID

3)运行:sudo docker service rm ID

4)现在尝试再次运行create命令

希望有帮助