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

docker-compose: restart not respected #9579

Closed
niklasfi opened this issue Mar 2, 2021 · 12 comments · Fixed by #10595
Closed

docker-compose: restart not respected #9579

niklasfi opened this issue Mar 2, 2021 · 12 comments · Fixed by #10595
Assignees
Labels
kind/bug Categorizes issue or PR as related to a bug. locked - please file new issue/PR Assist humans wanting to comment on an old issue or PR with locked comments.

Comments

@niklasfi
Copy link

niklasfi commented Mar 2, 2021

Is this a BUG REPORT or FEATURE REQUEST? (leave only one on its own line)

/kind bug

Description

The restart attribute of services is not respected in docker-compose files

Steps to reproduce the issue:

  1. create dockerfile with the following contents:
FROM docker.io/library/busybox

ENTRYPOINT /bin/false
  1. build container: sudo podman build -t fail .

  2. create docker-compose.yaml with following contents:

version: '3.9'

services:
    ok:
        image: nginx
        restart: always
    fail:
        image: fail
        restart: always
  1. start with sudo docker-compose up

Describe the results you received:

running with docker-compose on podman, the failing container is not restarted:

sudo docker-compose up
Creating network "x_default" with the default driver
Creating x_ok_1   ... done
Creating x_fail_1 ... done
Attaching to x_fail_1, x_ok_1
ok_1    | /docker-entrypoint.sh: /docker-entrypoint.d/ is not empty, will attempt to perform configuration
ok_1    | /docker-entrypoint.sh: Looking for shell scripts in /docker-entrypoint.d/
ok_1    | /docker-entrypoint.sh: Launching /docker-entrypoint.d/10-listen-on-ipv6-by-default.sh
ok_1    | 10-listen-on-ipv6-by-default.sh: info: Getting the checksum of /etc/nginx/conf.d/default.conf
ok_1    | 10-listen-on-ipv6-by-default.sh: info: Enabled listen on IPv6 in /etc/nginx/conf.d/default.conf
ok_1    | /docker-entrypoint.sh: Launching /docker-entrypoint.d/20-envsubst-on-templates.sh
ok_1    | /docker-entrypoint.sh: Launching /docker-entrypoint.d/30-tune-worker-processes.sh
ok_1    | /docker-entrypoint.sh: Configuration complete; ready for start up
x_fail_1 exited with code 1
^CGracefully stopping... (press Ctrl+C again to force)
Stopping x_ok_1   ... done

Describe the results you expected:

running with "real" docker, the failing container is restarted again and again (as requested by restart: always)

sudo docker-compose up
Creating network "x_default" with the default driver
Creating x_ok_1   ... done
Creating x_fail_1 ... done
Attaching to x_fail_1, x_ok_1
ok_1    | /docker-entrypoint.sh: /docker-entrypoint.d/ is not empty, will attempt to perform configuration
ok_1    | /docker-entrypoint.sh: Looking for shell scripts in /docker-entrypoint.d/
ok_1    | /docker-entrypoint.sh: Launching /docker-entrypoint.d/10-listen-on-ipv6-by-default.sh
ok_1    | 10-listen-on-ipv6-by-default.sh: info: Getting the checksum of /etc/nginx/conf.d/default.conf
ok_1    | 10-listen-on-ipv6-by-default.sh: info: Enabled listen on IPv6 in /etc/nginx/conf.d/default.conf
ok_1    | /docker-entrypoint.sh: Launching /docker-entrypoint.d/20-envsubst-on-templates.sh
ok_1    | /docker-entrypoint.sh: Launching /docker-entrypoint.d/30-tune-worker-processes.sh
ok_1    | /docker-entrypoint.sh: Configuration complete; ready for start up
x_fail_1 exited with code 1
x_fail_1 exited with code 1
x_fail_1 exited with code 1
x_fail_1 exited with code 1
x_fail_1 exited with code 1

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

Output of podman version:

podman version
Version:      3.0.1
API Version:  3.0.0
Go Version:   go1.15.8
Built:        Fri Feb 19 17:56:17 2021
OS/Arch:      linux/amd64

Output of podman info --debug:

host:
  arch: amd64
  buildahVersion: 1.19.4
  cgroupManager: cgroupfs
  cgroupVersion: v1
  conmon:
    package: conmon-2.0.26-1.fc33.x86_64
    path: /usr/bin/conmon
    version: 'conmon version 2.0.26, commit: 777074ecdb5e883b9bec233f3630c5e7fa37d521'
  cpus: 12
  distribution:
    distribution: fedora
    version: "33"
  eventLogger: journald
  hostname: p53
  idMappings:
    gidmap:
    - container_id: 0
      host_id: 1000
      size: 1
    - container_id: 1
      host_id: 100000
      size: 65536
    uidmap:
    - container_id: 0
      host_id: 1000
      size: 1
    - container_id: 1
      host_id: 100000
      size: 65536
  kernel: 5.10.18-200.fc33.x86_64
  linkmode: dynamic
  memFree: 55989383168
  memTotal: 67034587136
  ociRuntime:
    name: crun
    package: crun-0.18-1.fc33.x86_64
    path: /usr/bin/crun
    version: |-
      crun version 0.18
      commit: 808420efe3dc2b44d6db9f1a3fac8361dde42a95
      spec: 1.0.0
      +SYSTEMD +SELINUX +APPARMOR +CAP +SECCOMP +EBPF +CRIU +YAJL
  os: linux
  remoteSocket:
    path: /run/user/1000/podman/podman.sock
  security:
    apparmorEnabled: false
    capabilities: CAP_CHOWN,CAP_DAC_OVERRIDE,CAP_FOWNER,CAP_FSETID,CAP_KILL,CAP_NET_BIND_SERVICE,CAP_SETFCAP,CAP_SETGID,CAP_SETPCAP,CAP_SETUID,CAP_SYS_CHROOT
    rootless: true
    seccompEnabled: true
    selinuxEnabled: true
  slirp4netns:
    executable: /usr/bin/slirp4netns
    package: slirp4netns-1.1.8-1.fc33.x86_64
    version: |-
      slirp4netns version 1.1.8
      commit: d361001f495417b880f20329121e3aa431a8f90f
      libslirp: 4.3.1
      SLIRP_CONFIG_VERSION_MAX: 3
      libseccomp: 2.5.0
  swapFree: 37878751232
  swapTotal: 37878751232
  uptime: 2h 15m 51.15s (Approximately 0.08 days)
registries:
  search:
  - registry.fedoraproject.org
  - registry.access.redhat.com
  - registry.centos.org
  - docker.io
store:
  configFile: /home/niklas/.config/containers/storage.conf
  containerStore:
    number: 0
    paused: 0
    running: 0
    stopped: 0
  graphDriverName: overlay
  graphOptions:
    overlay.mount_program:
      Executable: /usr/bin/fuse-overlayfs
      Package: fuse-overlayfs-1.4.0-1.fc33.x86_64
      Version: |-
        fusermount3 version: 3.9.3
        fuse-overlayfs: version 1.4
        FUSE library version 3.9.3
        using FUSE kernel interface version 7.31
  graphRoot: /home/niklas/.local/share/containers/storage
  graphStatus:
    Backing Filesystem: btrfs
    Native Overlay Diff: "false"
    Supports d_type: "true"
    Using metacopy: "false"
  imageStore:
    number: 87
  runRoot: /run/user/1000/containers
  volumePath: /home/niklas/.local/share/containers/storage/volumes
version:
  APIVersion: 3.0.0
  Built: 1613753777
  BuiltTime: Fri Feb 19 17:56:17 2021
  GitCommit: ""
  GoVersion: go1.15.8
  OsArch: linux/amd64
  Version: 3.0.1

Package info (e.g. output of rpm -q podman or apt list podman):

podman-3.0.1-1.fc33.x86_64

Have you tested with the latest version of Podman and have you checked the Podman Troubleshooting Guide?

No

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

@openshift-ci-robot openshift-ci-robot added the kind/bug Categorizes issue or PR as related to a bug. label Mar 2, 2021
@mheon
Copy link
Member

mheon commented Mar 17, 2021

Self-assigning

@mheon mheon self-assigned this Mar 17, 2021
@github-actions
Copy link

A friendly reminder that this issue had no activity for 30 days.

@rhatdan
Copy link
Member

rhatdan commented Apr 19, 2021

@mheon did you ever get a chance to look at this?

@mheon
Copy link
Member

mheon commented Apr 19, 2021

Just enough to realize it wasn't nearly as simple as I initially thought 😄

I'll take another look this week

@nanonyme
Copy link

nanonyme commented May 8, 2021

Is it in scope of this or a separate item that containers are also not automatically restarted when host restarts despite restart: always being set?

@github-actions
Copy link

github-actions bot commented Jun 8, 2021

A friendly reminder that this issue had no activity for 30 days.

@rhatdan
Copy link
Member

rhatdan commented Jun 8, 2021

@boaz0 @mheon Once we have the systemd unit file to start all restart=always at boot this issue can be closed.

@boaz0
Copy link
Collaborator

boaz0 commented Jun 8, 2021

@rhatdan thanks. I will add it to the closed issues in the PR.

@mheon
Copy link
Member

mheon commented Jun 8, 2021

@rhatdan I think the Compat API is not respecting restart policy, so it might not be fixed after that.

@boaz0
Copy link
Collaborator

boaz0 commented Jun 8, 2021

@mheon how can I test that? Should I run podman system service using tcp protocol? And what API request should I send?

@mheon
Copy link
Member

mheon commented Jun 8, 2021

At this point, I think the reproducer will require a Docker-compose setup - have Compose talking to podman system service, let it create the container, and do a podman inspect on what it creates to verify that restart policy was set correctly. If podman inspect says the restart policy is set to always then we made the containers correctly and everything should be working.

@boaz0
Copy link
Collaborator

boaz0 commented Jun 8, 2021

I will check this out tonight and update this issue. Thanks @mheon

@github-actions github-actions bot added the locked - please file new issue/PR Assist humans wanting to comment on an old issue or PR with locked comments. label Sep 21, 2023
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 21, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
kind/bug Categorizes issue or PR as related to a bug. locked - please file new issue/PR Assist humans wanting to comment on an old issue or PR with locked comments.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants