如何运行使用最新版本Ubuntu(18.10)中的SystemD的Docker容器? [英] How do I run a Docker container that uses SystemD from the latest version of Ubuntu (18.10)?

查看:101
本文介绍了如何运行使用最新版本Ubuntu(18.10)中的SystemD的Docker容器?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图执行使用'ubuntu:latest'构建的Docker映像,并且在运行容器时不断收到SystemD错误消息:

I'm trying to execute a Docker image built using 'ubuntu:latest' and I keep getting SystemD error messages when I run the container:

System has not been booted with systemd as init system (PID 1). Can't operate.

如果我尝试使用此解决方案并生成容器使用 docker run -it -e container = docker your-image-name/sbin/init ,我收到以下错误:

If I try this solution and spawn the container using docker run -it -e container=docker your-image-name /sbin/init, I get the following error:

Failed to mount tmpfs at /run: Operation not permitted
Failed to mount tmpfs at /run/lock: Operation not permitted
[!!!!!!] Failed to mount API filesystems, freezing.
Freezing execution.

我应该怎么做?

推荐答案

您可以使用其他版本(例如16.04)来解决此问题:

You can solve this using a different version, like 16.04:

docker run -d \
  -h ubuntu \
  --name ubuntu \
  --privileged \
  docker.io/library/ubuntu:16.04 /sbin/init

运行后,您可以使用以下命令进行访问:

After run, you can accessed using the follow command:

docker exec -it ubuntu /bin/bash

此版本使用 systemd .

这篇关于如何运行使用最新版本Ubuntu(18.10)中的SystemD的Docker容器?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆