如何在google colab上运行docker

问题描述 投票:0回答:1

我尝试使用我在另一个问题中找到的以下命令在google colab上安装docker: %%shell sudo apt update -qq sudo apt install apt-transport-https ca-certificates curl software-properties-common -qq curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add - sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu bionic stable" -y sudo apt update -qq -y sudo apt install docker-ce -y docker

然后我尝试确认 docker 适用于以下内容:

!docker --version !docker info !docker run hello-world

给出以下信息和错误:

Docker version 24.0.2, build cb74dfc Client: Docker Engine - Community Version: 24.0.2 Context: default Debug Mode: false Plugins: buildx: Docker Buildx (Docker Inc.) Version: v0.10.5 Path: /usr/libexec/docker/cli-plugins/docker-buildx compose: Docker Compose (Docker Inc.) Version: v2.18.1 Path: /usr/libexec/docker/cli-plugins/docker-compose Server: ERROR: Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running? errors pretty printing info docker: Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?. See 'docker run --help'.

然后我尝试了各种命令来启动 docker 守护进程,例如 
!sudo systemctl start docker

给出了输出

docker: Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?. See 'docker run --help'. System has not been booted with systemd as init system (PID 1). Can't operate. Failed to connect to bus: Host is down

	
docker google-colaboratory
1个回答
0
投票
udocker

!pip install udocker

!udocker --allow-root install

然后您必须使用 
--allow-root

标志运行 udocker 命令。

    

© www.soinside.com 2019 - 2024. All rights reserved.