kution 发表于 2015-10-13 10:01:46

docker_work_with_images

默认为root权限
1、Listing images on the host
docker images

2、listing runing container
docker ps

3、get images
(1)、docker run -t -i ubuntu:14.04 /bin/sh #若local没有ubuntu14.04的image,能联网则会从 Docker Hub下载
(2)、docker pull ubuntu:14.04
(2)与(1)不同的是,pull会预先下载(Well Docker will automatically download any image we use that isn't
already present on the Docker host. But this can potentially add some time to the launch of a container.
If we want to pre-load an image we can download it using the docker pull command. Let's say we'd like
to download the centos image.)
总之,(1)登录到容器慢些(2)快些
(3)dockerfile
dockerfile 一般为
FROM baseimage
MAINTAINER kate smith <ksmith@example.com>
RUN ...
RUN ...
使用docker build -t name/space . #须在dockerfile所在目录下执行该命令,注意.的存在

4、updating and commiting an images
docker commit -m “message” -a &quot;john&quot; #-m version info -a author info

5、find images
docker search ubunte #从local和docker hub查找images

6、Setting tags on an image
你可以为commit or build 的image 设置tag
docker tag 5db5f8471261 ouruser/sinatra:devel

7、Push an image to Docker Hub
一旦你build or create image,你可以上传到docker Hub与别人share,你也可以上传到自己的private reposity。
docker push ouruser/sinatra

8、Remove an image from the host
从local删除image
docker rmi training/sinatra
页: [1]
查看完整版本: docker_work_with_images