Skip to content

Mac M1 - Ubuntu image not running under ARM architectureΒ #406

@marcusschiesser

Description

@marcusschiesser

How can the ubuntu image be run on Mac M1 on ARM architecture?

I am using the following setup:

  • Mac M1 with MacOS 13.0.1
  • Docker Desktop 4.16.2 with Rosetta enabled
  • Visual Studio Code 1.17.3

Using the devcontainer.json below, processes are running on x86 arch as uname shows:

# uname -m
x86_64

How can the devcontainer run on ARM?

// For format details, see https://aka.ms/devcontainer.json. For config options, see the README at:
// https://github.com/devcontainers/images/tree/main/src/base-ubuntu
{
  "name": "Ubuntu",
  "image": "mcr.microsoft.com/devcontainers/base:ubuntu",
  // Set *default* container specific settings.json values on container create.
  "settings": {
    "python.defaultInterpreterPath": "/usr/local/bin/python",
    "python.linting.enabled": true,
    "python.linting.pylintEnabled": true,
    "python.formatting.autopep8Path": "/usr/local/py-utils/bin/autopep8",
    "python.formatting.blackPath": "/usr/local/py-utils/bin/black",
    "python.formatting.yapfPath": "/usr/local/py-utils/bin/yapf",
    "python.linting.banditPath": "/usr/local/py-utils/bin/bandit",
    "python.linting.flake8Path": "/usr/local/py-utils/bin/flake8",
    "python.linting.mypyPath": "/usr/local/py-utils/bin/mypy",
    "python.linting.pycodestylePath": "/usr/local/py-utils/bin/pycodestyle",
    "python.linting.pydocstylePath": "/usr/local/py-utils/bin/pydocstyle",
    "python.linting.pylintPath": "/usr/local/py-utils/bin/pylint"
  },
  // Add the IDs of extensions you want installed when the container is created.
  "extensions": [
    "ms-python.python",
    "ms-python.vscode-pylance",
    "ms-azuretools.vscode-docker",
    "Splunk.splunk",
    "esbenp.prettier-vscode",
    "dbaeumer.vscode-eslint",
    "steoates.autoimport",
    "mgmcdermott.vscode-language-babel",
    "streetsidesoftware.code-spell-checker",
    "shivanshu-gupta.scratchpads",
    "thenuprojectcontributors.vscode-nushell-lang"
  ],
  // Use 'forwardPorts' to make a list of ports inside the container available locally.
  // "forwardPorts": [],
  // Use 'postCreateCommand' to run commands after the container is created.
  // "postCreateCommand": "pip3 install --user -r requirements.txt",
  // Comment out to connect as root instead. More info: https://aka.ms/vscode-remote/containers/non-root.
  "remoteUser": "vscode",
  "remoteEnv": {
    "LOCAL_WORKSPACE_FOLDER": "${localWorkspaceFolder}"
  },
  "features": {
    "ghcr.io/devcontainers/features/docker-outside-of-docker:1": "latest",
    "ghcr.io/devcontainers/features/node:1": {
      "version": "16"
    },
    "ghcr.io/devcontainers/features/python:1": {
      "version": "3.7"
    }
  }
}

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