这是indexloc提供的服务,不要输入任何密码
Skip to content

DevPod will re-initialize the container at the first stop/up cycle #1925

@peter-kwan

Description

@peter-kwan

What happened?

The very first stop/up cycle of a new workspace sees DevPod re-initializing the container. This wipes out any work inside the container immediately after the workspace was created. It does not matter whether the stop was triggered by inactivity timeout, or by an explicit devpod stop command.

Once the workspace is restarted once, all subsequent restart cycles work as expected -- ie, the container isn't re-initialized. States of the container are preserved in restarts.

Our team workaround this by running a stop/up cycle right after a new workspace is created, before we do anything inside the container.

What did you expect to happen instead?

The first devpod stop should preserve the state of the container. Or the immediate subsequent devpod up should not re-initialize the container.

How can we reproduce the bug? (as minimally and precisely as possible)

  1. Create an AWS provider
  2. devpod up a workspace off of a GitHub repo
  3. devpod stop the workspace
  4. Run this in the container: echo `date` > ~/i-was-here.txt.
  5. devpod up the workspace
    a. Here, observe from the logs that the container got reinstalled.
    b. Once the container is up, observe that the ~/i-was-here.txt file is not there.

My devcontainer.json:

{
  "name": "Chariot Devpod Container",
  "image": "ghcr.io/praetorian-inc/chariot-devpod:latest",
  "features": {
    "ghcr.io/devcontainers/features/desktop-lite:1": {}
  },
  "runArgs": ["--shm-size=2gb"],
  "forwardPorts": [9222],
  "postCreateCommand": "sudo chsh -s $(which zsh) $(whoami)"
}

Local Environment:

  • DevPod Version: v0.6.15
  • Operating System: mac
  • ARCH of the OS: ARM64

DevPod Provider:

  • Cloud Provider: aws

Anything else we need to know?
Here is the first few lines of the stdout logs of:

  • the first devpod up (correctly created the workspace)
  • the second devpod up (incorrectly re-initialized the container, wiping out work)
  • the third devpod up (correctly latched on to the existing container)

First logs of the first devpod up (correctly created the workspace):

❯ devpod up --provider aws   github.com/praetorian-inc/chariot-development-platform@peter/smoother-devpod-17th --ide cursor --id zsh6
19:39:46 info Create machine 'zsh6-bece2' with provider 'aws'...
19:39:49 done Successfully created machine 'zsh6-bece2' with provider 'aws'
19:39:51 info Creating devcontainer...
19:40:03 info Waiting for devpod agent to come up...
19:40:12 info # Executing docker install script, commit: 1d97565eca92bb523082b7d4f530c74104e05d35
19:40:12 info Download binary AWS_PROVIDER from https://github.com/loft-sh/devpod-provider-aws/releases/download/v0.0.17/devpod-provider-aws-linux-amd64
19:40:12 info + sh -c apt-get update -qq >/dev/null
19:40:13 info Clone repository
19:40:13 info URL: https://github.com/praetorian-inc/chariot-development-platform
19:40:13 info Branch: peter/smoother-devpod-17th
19:40:16 done Successfully cloned repository
19:40:16 info Successfully installed DevPod daemon into server
19:40:22 info + sh -c DEBIAN_FRONTEND=noninteractive apt-get install -y -qq apt-transport-https ca-certificates curl >/dev/null
19:40:25 info
19:40:25 info Running kernel seems to be up-to-date.

First logs of the second devpod up (incorrectly re-initialized the container, wiping out work)

❯ devpod up zsh6
19:43:44 info Workspace zsh6 already exists
19:43:44 info Starting machine 'zsh6-bece2'...
19:43:45 done Successfully started 'zsh6-bece2'
19:43:45 info Creating devcontainer...
19:43:56 info Waiting for devpod agent to come up...
19:44:00 info Configuring docker daemon ...
19:44:03 info Build with docker buildx...
19:44:03 info #0 building with "default" instance using docker driver
19:44:03 info
19:44:03 info #1 [internal] load build definition from Dockerfile-with-features
19:44:03 info #1 transferring dockerfile: 783B done
19:44:03 info #1 DONE 0.1s
19:44:03 info

First logs of the third devpod up (correctly latched on to the existing container)

❯ devpod up zsh6
20:11:07 info Workspace zsh6 already exists
20:11:07 info Starting machine 'zsh6-bece2'...
20:11:08 done Successfully started 'zsh6-bece2'
20:11:08 info Creating devcontainer...
20:11:19 info Waiting for devpod agent to come up...
20:11:24 info Configuring docker daemon ...
20:11:26 info Setup container...
20:11:26 info Run 'ssh zsh6.devpod' to ssh into the devcontainer
20:11:26 info Starting Cursor...

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions