I'm newbie in the Docker, so I need your advice.
I try to move under docker containers my current system of java application based on Jboss AS. I have different host machines with 1, 2 or 3 jboss as. I've configured this system to run in the swarm mode as stack where each jboss is separate service. I use host network with global mode. Also I use docker-compose file to discribe all system.
What I need - ability to stop a specific service. I can stop service using 'docker service rm' command but it removes this service from stack fully. If I stopped some services and then I want to start only one from these, I can't find any command to do this. Is there any solution to do this using docker swarm? Or I need to look toward the Kubernetes?
In common case, I want to have the single point to configure and control my system.
Below the example of my docker-compose file.
version: '3.5'
x-common-deploy-config:
&common-deploy-config
mode: global
restart_policy:
condition: on-failure
x-default-jboss:
&default-jboss
image: some-image
networks:
hostnet: {}
command: ["./scripts/run.sh"]
x-jboss-c1:
&jboss-c1
<< : *default-jboss
volumes:
- "/data/jboss-docker-test/logs/c1:/data/jboss/server/log"
environment:
- JBOSS_PORT_OFFSET=ports-01
- JBOSS_SERVER_NUMBER=1
x-jboss-c2:
&jboss-c2
<< : *default-jboss
volumes:
- "/data/jboss-docker-test/logs/c2:/data/jboss/server/log"
environment:
- JBOSS_PORT_OFFSET=ports-02
- JBOSS_SERVER_NUMBER=2
services:
jboss-28-c1:
<< : *jboss-c1
env_file: host_1.28.env
deploy:
<< : *common-deploy-config
placement:
constraints:
- node.labels.hostaddress == 192.168.1.28
jboss-28-c2:
<< : *jboss-c2
env_file: host_1.28.env
deploy:
<< : *common-deploy-config
placement:
constraints:
- node.labels.hostaddress == 192.168.1.28
command: ["./scripts/run.sh", "1"]
networks:
hostnet:
external: true
name: host
You can use docker service scale and make the replicas to 0. docker service scale documentation
It has mentioned the solution.
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.