生成并运行容器,但没有容器
我有一个dockerfile看起来像这样
FROM ubuntu MAINTAINER abc <abc.yur@gmail.com> RUN apt-get update RUN apt-get install nano RUN apt-get install -y software-properties-common python-software-properties RUN add-apt-repository ppa:longsleep/golang-backports RUN apt-get update RUN apt-get -y install golang-go git RUN mkdir /work ENV GOPATH=/work RUN go get github.com/abc/golang RUN go build github.com/abc/golang CMD /golang -addr $ADDR -workers $WORKERS
所以我想构build和运行容器,但在build设( docker build .
)后,我不能运行这个容器。 所以当我运行docker ps -a
或docker ps
,没有容器可以运行
docker build .
这会创build图像而不是容器。 你需要使用
docker images
获取图像列表。
docker ps
将显示当你运行一个容器使用像下面的东西
docker run -d <image>