简体   繁体   中英

Running Docker Compose on Docker Swarm

I've started a docker master with:

docker swarm init --advertise-addr <MANAGER-IP>

so, im trying to have my shell point to swarm master via:

eval $(docker-machine env --swarm <MANAGER-IP>)

but it's giving me an error: Host does not exists

docker info :

-bash-4.2$ docker info
Containers: 18
 Running: 1
 Paused: 0
 Stopped: 17
Images: 20
Server Version: 1.12.0
Storage Driver: devicemapper
 Pool Name: docker-253:1-25646-pool
 Pool Blocksize: 65.54 kB
 Base Device Size: 10.74 GB
 Backing Filesystem: xfs
 Data file: /dev/loop0
 Metadata file: /dev/loop1
 Data Space Used: 3.124 GB
 Data Space Total: 107.4 GB
 Data Space Available: 13.4 GB
 Metadata Space Used: 5.071 MB
 Metadata Space Total: 2.147 GB
 Metadata Space Available: 2.142 GB
 Thin Pool Minimum Free Space: 10.74 GB
 Udev Sync Supported: true
 Deferred Removal Enabled: false
 Deferred Deletion Enabled: false
 Deferred Deleted Device Count: 0
 Data loop file: /var/lib/docker/devicemapper/devicemapper/data
 WARNING: Usage of loopback devices is strongly discouraged for production use. Use `--storage-opt dm.thinpooldev` to specify a custom block storage device.
 Metadata loop file: /var/lib/docker/devicemapper/devicemapper/metadata
 Library Version: 1.02.107-RHEL7 (2016-06-09)
Logging Driver: json-file
Cgroup Driver: cgroupfs
Plugins:
 Volume: local
 Network: host bridge null overlay
Swarm: active
 NodeID: 05szzy2z96ypgl5k21swggoil
 Is Manager: true
 ClusterID: a2wrfuga2tu4cm4k0lxxorqtm
 Managers: 1
 Nodes: 3
 Orchestration:
  Task History Retention Limit: 5
 Raft:
  Snapshot interval: 10000
  Heartbeat tick: 1
  Election tick: 3
 Dispatcher:
  Heartbeat period: 5 seconds
 CA configuration:
  Expiry duration: 3 months
 Node Address: 10.193.46.89
Runtimes: runc
Default Runtime: runc
Security Options: seccomp
Kernel Version: 3.10.0-327.28.2.el7.x86_64
Operating System: CentOS Linux 7 (Core)
OSType: linux
Architecture: x86_64
CPUs: 4
Total Memory: 15.51 GiB
Name: scsor0004331002.rtp.openenglab.netapp.com
ID: T52U:6MWQ:XEDM:2TGH:ITLQ:YD6B:R3MR:MWF5:CFBM:G6PX:W4LG:6SR7
Docker Root Dir: /var/lib/docker
Debug Mode (client): false
Debug Mode (server): false
Username: eugenepark3
Registry: https://index.docker.io/v1/
WARNING: bridge-nf-call-ip6tables is disabled
Insecure Registries:
 127.0.0.0/8

Anyone know what i need to put for eval $(docker-machine env --swarm <MANAGER-IP>) so my compose can run on swarm cluster?

Im supposed to put master name but i dont know how to find it

-bash-4.2$ docker node ls
ID                           HOSTNAME                                   STATUS  AVAILABILITY  MANAGER STATUS
05szzy2z96ypgl5k21swggoil *  scsor0004331002.rtp.openenglab.netapp.com  Ready   Active        Leader
59t110b0wjhitj1fr8erys600    scsor0004331003.rtp.openenglab.netapp.com  Ready   Active
dhm6utu2w3dw1to0zh3n71moq    scsor0004331004.rtp.openenglab.netapp.com  Ready   Active

You're mixing up the container based swarm commands with the newer swarmkit based Swarm that's been embedded directly into the Docker CLI. With the new version of Swarm, docker-compose isn't directly supported, yet. Consider this a beta product that works well for a limited scope. You can try the experimental release of the docker engine which adds support for DAB files that are managed with the docker stack CLI. The DAB files are exported from docker-compose bundle and then imported into Docker. This feature is still very experimental and expected to change.

Without that, anything with docker-compose will only operate on a single docker engine since the swarm access is all done under a different docker service CLI interface.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM