1
我試圖創建一個ubuntu docker鏡像,但是當我檢查進程時進程沒有在後臺運行。碼頭過程沒有在後臺運行
下面是命令
PREMs-MacBook-Pro:Documents prem$ docker run ubuntu:16.04 grep -v '^#' /etc/apt/sources.list
deb http://archive.ubuntu.com/ubuntu/ xenial main restricted
deb http://archive.ubuntu.com/ubuntu/ xenial-updates main restricted
deb http://archive.ubuntu.com/ubuntu/ xenial universe
deb-src http://archive.ubuntu.com/ubuntu/ xenial universe
deb http://archive.ubuntu.com/ubuntu/ xenial-updates universe
deb-src http://archive.ubuntu.com/ubuntu/ xenial-updates universe
deb http://archive.ubuntu.com/ubuntu/ xenial multiverse
deb http://archive.ubuntu.com/ubuntu/ xenial-updates multiverse
deb http://archive.ubuntu.com/ubuntu/ xenial-backports main restricted universe multiverse
deb http://security.ubuntu.com/ubuntu/ xenial-security main restricted
deb http://security.ubuntu.com/ubuntu/ xenial-security universe
deb-src http://security.ubuntu.com/ubuntu/ xenial-security universe
deb http://security.ubuntu.com/ubuntu/ xenial-security multiverse
PREMs-MacBook-Pro:Documents prem$ docker run ubuntu:16.04 grep -v '^#' /etc/apt/sources.list
deb http://archive.ubuntu.com/ubuntu/ xenial main restricted
deb http://archive.ubuntu.com/ubuntu/ xenial-updates main restricted
deb http://archive.ubuntu.com/ubuntu/ xenial universe
deb-src http://archive.ubuntu.com/ubuntu/ xenial universe
deb http://archive.ubuntu.com/ubuntu/ xenial-updates universe
deb-src http://archive.ubuntu.com/ubuntu/ xenial-updates universe
deb http://archive.ubuntu.com/ubuntu/ xenial multiverse
deb http://archive.ubuntu.com/ubuntu/ xenial-updates multiverse
deb http://archive.ubuntu.com/ubuntu/ xenial-backports main restricted universe multiverse
deb http://security.ubuntu.com/ubuntu/ xenial-security main restricted
deb http://security.ubuntu.com/ubuntu/ xenial-security universe
deb-src http://security.ubuntu.com/ubuntu/ xenial-security universe
deb http://security.ubuntu.com/ubuntu/ xenial-security multiverse
PREMs-MacBook-Pro:Documents prem$ docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
爲什麼你認爲'docker run ubuntu:16.04 grep ...'會在後臺運行,尤其是考慮到它會在你面前打印輸出? – jwodder
當我做一個docker ps時,它沒有列出'container id'..當我添加ps -a時,它列出了所有的進程。在你的問題背景中,我沒有包含-d命令。 – user1050619
所以你知道'-d'會在後臺運行Docker容器。你有什麼問題? – jwodder