Skip to content

docker-compose recreate results in duplicate containers in k0s #4917

Open

Description

Before creating an issue, make sure you've checked the following:

  • You are running the latest released version of k0s
  • Make sure you've searched for existing issues, both open and closed
  • Make sure you've searched for PRs too, a fix might've been merged already
  • You're looking at docs for the released version, "main" branch docs are usually ahead of released versions.

Platform

Linux 6.1.0-23-amd64 #1 SMP PREEMPT_DYNAMIC Debian 6.1.99-1 (2024-07-15) x86_64 GNU/Linux
PRETTY_NAME="Debian GNU/Linux 12 (bookworm)"
NAME="Debian GNU/Linux"
VERSION_ID="12"
VERSION="12 (bookworm)"
VERSION_CODENAME=bookworm
ID=debian
HOME_URL="https://www.debian.org/"
SUPPORT_URL="https://www.debian.org/support"
BUG_REPORT_URL="https://bugs.debian.org/"

Docker version 27.2.0, build 3ab4256
docker-compose version 1.24.1, build 4667896b

Version

v1.30.4+k0s.0

Sysinfo

`k0s sysinfo`
Total memory: 15.6 GiB (pass)
Disk space available for /var/lib/k0s: 111.0 GiB (pass)
Name resolution: localhost: [::1 127.0.0.1] (pass)
Operating system: Linux (pass)
  Linux kernel release: 6.1.0-23-amd64 (pass)
  Max. file descriptors per process: current: 1048576 / max: 1048576 (pass)
  AppArmor: unavailable (pass)
  Executable in PATH: modprobe: /sbin/modprobe (pass)
  Executable in PATH: mount: /bin/mount (pass)
  Executable in PATH: umount: /bin/umount (pass)
  /proc file system: mounted (0x9fa0) (pass)
  Control Groups: version 2 (pass)
    cgroup controller "cpu": available (is a listed root controller) (pass)
    cgroup controller "cpuacct": available (via cpu in version 2) (pass)
    cgroup controller "cpuset": available (is a listed root controller) (pass)
    cgroup controller "memory": available (is a listed root controller) (pass)
    cgroup controller "devices": available (device filters attachable) (pass)
    cgroup controller "freezer": available (cgroup.freeze exists) (pass)
    cgroup controller "pids": available (is a listed root controller) (pass)
    cgroup controller "hugetlb": available (is a listed root controller) (pass)
    cgroup controller "blkio": available (via io in version 2) (pass)
  CONFIG_CGROUPS: Control Group support: no kernel config found (warning)
  CONFIG_NAMESPACES: Namespaces support: no kernel config found (warning)
  CONFIG_NET: Networking support: no kernel config found (warning)
  CONFIG_EXT4_FS: The Extended 4 (ext4) filesystem: no kernel config found (warning)
  CONFIG_PROC_FS: /proc file system support: no kernel config found (warning)

What happened?

When docker compose recreates the container, k0s takes a very long time to start and shows permanently and repeatedly errors stating "Failed to create existing container". There seem to be duplicate containers within k0s.

Steps to reproduce

  1. docker compose up
  2. Wait for k0s to fully come up
  3. Stop container
  4. Change compose YAML and start k0s again
    or force recreation with docker compose up --force-recreate

Expected behavior

No errors in log; No duplicate containers

Actual behavior

k0s tries to create containers already existing(?)

Screenshots and logs

docker compose log

`k0s ctr c ls`
CONTAINER                                                           IMAGE                                                       RUNTIME
2bcaf4bcf32710a2c563716594e2e538cb158afe1aec109ae0a215e42efd8345    quay.io/k0sproject/coredns:1.11.3                           io.containerd.runc.v2
419389b290c80ec83c3461d24c2d8631665cf30d0940cd40952293116366a29b    quay.io/k0sproject/metrics-server:v0.7.1-0                  io.containerd.runc.v2
56c2bf1467029eeba647ab426045e841aecb1bca7fb2eed36540b0b43fad93fd    registry.k8s.io/pause:3.9                                   io.containerd.runc.v2
590348540307df03618c1da827fd503654997cb9306fab31d331b2f256e07119    registry.k8s.io/pause:3.9                                   io.containerd.runc.v2
5a66678e3f87612a62c69814b79274be8adb009e0d4f3a7f9504ef3586b84730    quay.io/k0sproject/cni-node:1.3.0-k0s.0                     io.containerd.runc.v2
5c3710e34cd93037a9c19d8f85c15430da302fc57c86e3f6487373205fa31fe1    quay.io/k0sproject/apiserver-network-proxy-agent:v0.30.3    io.containerd.runc.v2
6ae4cd8b47b3bd8014c7cf84b931aa4471d665baf2dfdb857259db01690b2e5f    quay.io/k0sproject/kube-router:v2.1.0-iptables1.8.9-0       io.containerd.runc.v2
7509e349ec9d4c1df0704d0df4b22f56cee1ecc5dbb125b27038d20f6aba4978    quay.io/k0sproject/metrics-server:v0.7.1-0                  io.containerd.runc.v2
79da1769cb09b3cf3220ec5c585fe8b88e5474fda78da071ad3a228c35f0fcd7    quay.io/k0sproject/apiserver-network-proxy-agent:v0.30.3    io.containerd.runc.v2
7ae882b191309b82302aa6771258e5e2c5b30e8b143986dad9afda1bc488287e    registry.k8s.io/pause:3.9                                   io.containerd.runc.v2
872b1600d0281fbe801f538c8185a2ac30b2d1909889b67142a58619f4e92c75    quay.io/k0sproject/kube-proxy:v1.30.4                       io.containerd.runc.v2
8d6c7e8d2e5890df9137446ac6229751abd6546f7dd6477af13dbc4fd41bc8cb    quay.io/k0sproject/kube-router:v2.1.0-iptables1.8.9-0       io.containerd.runc.v2
a535f368ab186ce20c7180240bb2f8d87feaff156ee9cb95755715c218455d2c    registry.k8s.io/pause:3.9                                   io.containerd.runc.v2
a797e2e4cebf204befff95175f693a3cb379fd7fae509a495c46399c2f875169    quay.io/k0sproject/kube-proxy:v1.30.4                       io.containerd.runc.v2
a9459cd0650882f0382105131c3ace5b67b02c83d0f2d2bc355be0be7aa95052    registry.k8s.io/pause:3.9                                   io.containerd.runc.v2
acdc4eec31eae5baddfd19a4605a5ec39ee23678a77b9a7dc0cdd7fa83987d38    registry.k8s.io/pause:3.9                                   io.containerd.runc.v2
aea02521871751ded3d2f6a98b68c346c799caaf2a72052d5d7639515f96f86f    registry.k8s.io/pause:3.9                                   io.containerd.runc.v2
b68aa17067a7a5a375e66aaf6fb2737c1ad9b8749ff9874b5d662b5f5a934f3e    quay.io/k0sproject/coredns:1.11.3                           io.containerd.runc.v2
deb8fa4f027d19db26e23ca39380b51370b045035c577022edc185d3d1fbca2c    registry.k8s.io/pause:3.9                                   io.containerd.runc.v2
f846566cc18328a014cd71f6ee11e6ae660ad907e3bc6297abce2c119f807235    registry.k8s.io/pause:3.9                                   io.containerd.runc.v2

Additional context

docker-compose.yml:

services:
  k0s:
    container_name: k0s
    image: docker.io/k0sproject/k0s:v1.30.4-k0s.0
    command: k0s controller --config=/etc/k0s/config.yaml --enable-worker
    hostname: k0s
    privileged: true
    cgroup: host
    volumes:
      - "/var/lib/k0s"
    ports:
      - "6443:6443"
    network_mode: "bridge"
    environment:
      K0S_CONFIG: |-
        apiVersion: k0s.k0sproject.io/v1beta1
        kind: ClusterConfig
        metadata:
          name: k0s
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions