Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

different result of docker run --restart and docker swarm create --restart-condition #34585

Closed
Namsulee opened this issue Aug 21, 2017 · 2 comments

Comments

@Namsulee
Copy link

Namsulee commented Aug 21, 2017

Description
#32321
As I mentioned earlier, I do not want to re-create container even though the container is failed,
It would be restarted. But in case of swarm, there is option but it will make new container along to service. What I point out is, If I run docker run command with restart=always option, it will not be re-created new container even though docker daemon is restarted.
However docker service case, it will be re-created container if dockerd is restarted.(I also set task limit as 1, it looks container is only 1 but, it would be newly created.
I wonder how to use previous container which is created at first in case of service creation.

Steps to reproduce the issue:

pre : docker swarm init --task-history-limit 1

  1. Create service
    $ docker service create --name test --restart-condition any busybox tail -f /dev/null

2.Check service and container whether it runs or not

3.Kill dockerd

4.Start dockerd

  1. Check container
1. Create container

$ docker run -d --name test1 --restart always busybox tail -f /dev/null

2.Check service and container whether it runs or not

3.Kill dockerd

4.Start dockerd

  1. Check container

Describe the results you received:
container is the same after step4

Describe the results you expected:
in case of service, container is newly created

Additional information you deem important (e.g. issue happens only occasionally):

Output of docker version:

Client:
 Version:      17.06.1-ce
 API version:  1.30
 Go version:   go1.8.3
 Git commit:   874a737
 Built:        Thu Aug 17 22:53:09 2017
 OS/Arch:      linux/amd64

Server:
 Version:      17.06.1-ce
 API version:  1.30 (minimum version 1.12)
 Go version:   go1.8.3
 Git commit:   874a737
 Built:        Thu Aug 17 22:51:03 2017
 OS/Arch:      linux/amd64
 Experimental: false

Output of docker info:

Containers: 1
 Running: 1
 Paused: 0
 Stopped: 0
Images: 11
Server Version: 17.06.1-ce
Storage Driver: aufs
 Root Dir: /var/lib/docker/aufs
 Backing Filesystem: extfs
 Dirs: 24
 Dirperm1 Supported: 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: i70doe9wa5lgodkwm3oug5arx
 Is Manager: true
 ClusterID: xubb30c6be3k7d3ln676t6pt5
 Managers: 1
 Nodes: 1
 Orchestration:
  Task History Retention Limit: 1
 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
 Root Rotation In Progress: false
 Node Address: 127.0.0.1
 Manager Addresses:
  127.0.0.1:2377
Runtimes: runc
Default Runtime: runc
Init Binary: docker-init
containerd version: 6e23458c129b551d5c9871e5174f6b1b7f6d1170
runc version: 810190ceaa507aa2727d7ae6f4790c76ec150bd2
init version: 949e6fa
Security Options:
 apparmor
Kernel Version: 4.4.0-62-generic
Operating System: Ubuntu 14.04.5 LTS
OSType: linux
Architecture: x86_64
CPUs: 2
Total Memory: 1.763GiB
Name: namsu-H81H3-M4
ID: 6VSX:3RD6:BYDG:HGXJ:YINK:RADA:E6K7:RPVV:SGXV:LI56:OEDH:7JTI
Docker Root Dir: /var/lib/docker
Debug Mode (client): false
Debug Mode (server): false
Username: namsulee
Registry: https://index.docker.io/v1/
Experimental: false
Insecure Registries:
 13.124.64.10:80
 127.0.0.0/8
Live Restore Enabled: false

WARNING: No swap limit support

Additional environment details (AWS, VirtualBox, physical, etc.):

@cpuguy83
Copy link
Member

This is not possible and is intentionally designed this way.
Swarm tasks are created, they live, they die and that's it.
You can't resurrect them.

Likewise if you kill dockerd, even with live-restore enabled, swarm assumes the worst schedules new containers, if/when the original dockerd process comes back up, the existing containers will be killed and cleaned up.

@cpuguy83
Copy link
Member

Closing since this is working as designed, but feel free to discuss.
Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants