Skip to content

docker-in-docker -buildx gets removed on codespaces by "Configuring codespace..." step #549

Description

@stefan-cukl

.devcontainer/devcontainer.json

{
  "image": "mcr.microsoft.com/devcontainers/python:3",
  "features": {
    "ghcr.io/devcontainers/features/docker-in-docker:2": {
      "moby": false
    }
  }
}

the feature installs buildx under the ${_REMOTE_USER_HOME}/.docker/cli-plugins/docker-buildx path

if [ "${INSTALL_DOCKER_BUILDX}" = "true" ]; then
buildx_version="latest"
find_version_from_git_tags buildx_version "https://github.com/docker/buildx" "refs/tags/v"
echo "(*) Installing buildx ${buildx_version}..."
buildx_file_name="buildx-v${buildx_version}.linux-${architecture}"
cd /tmp && wget "https://github.com/docker/buildx/releases/download/v${buildx_version}/${buildx_file_name}"
mkdir -p ${_REMOTE_USER_HOME}/.docker/cli-plugins
mv ${buildx_file_name} ${_REMOTE_USER_HOME}/.docker/cli-plugins/docker-buildx

BUT there's a final step in the container build that removes the ${_REMOTE_USER_HOME}/.docker folder

creation.log @ codespaces

...
=================================================================================
2023-05-12 09:31:38.786Z: Configuring codespace...
2023-05-12 09:31:38.788Z: $ cp -r /root/.docker /var/lib/docker/codespacemount/.persistedshare
2023-05-12 09:31:38.789Z: cp process exited with exit code 0
2023-05-12 09:31:38.790Z: $ rm -rf /home/vscode/.docker
2023-05-12 09:31:38.791Z: rm process exited with exit code 0
2023-05-12 09:31:38.791Z: $ ln -sfn /workspaces/.codespaces/.persistedshare/.docker /home/vscode/.docker
2023-05-12 09:31:38.792Z: ln process exited with exit code 0
2023-05-12 09:31:38.792Z: $ chown -R vscode /workspaces/.codespaces/.persistedshare/.docker
2023-05-12 09:31:38.793Z: chown process exited with exit code 0

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions