本文共 8580 字,大约阅读时间需要 28 分钟。
[root@db-172-16-3-221 ~]# docker search postgresNAME DESCRIPTION STARS OFFICIAL AUTOMATEDpostgres The PostgreSQL object-relational database ... 273 [OK] paintedfox/postgresql A docker image for running Postgresql. 45 [OK]helmi03/docker-postgis PostGIS 2.1 in PostgreSQL 9.3 19 [OK]
The Official and Automated build statuses. Official repositories are built and maintained by the Stackbrew project, and Automated repositories are Automated Builds that allow you to validate the source and content of an image.Docker Official Images指docker标准库, 由docker 官方建立. 用户建立的image则会有userid的prefix.
We've reviewed the images available to use and we decided to use the training/sinatra image. So far we've seen two types of images repositories, images like ubuntu, which are called base or root images. These base images are provided by Docker Inc and are built, validated and supported. These can be identified by their single word names.We've also seen user images, for example the training/sinatra image we've chosen. A user image belongs to a member of the Docker community and is built and maintained by them. You can identify user images as they are always prefixed with the user name, here training, of the user that created them
Automated Builds automate the building and updating of images from GitHub or BitBucket, directly on Docker Hub. It works by adding a commit hook to your selected GitHub or BitBucket repository, triggering a build and update when you push a commit.To setup an Automated BuildCreate a Docker Hub account and login.Link your GitHub or BitBucket account through the "Link Accounts" menu.Configure an Automated Build.Pick a GitHub or BitBucket project that has a Dockerfile that you want to build.Pick the branch you want to build (the default is the master branch).Give the Automated Build a name.Assign an optional Docker tag to the Build.Specify where the Dockerfile is located. The default is /.Once the Automated Build is configured it will automatically trigger a build and, in a few minutes, you should see your new Automated Build on the Docker Hub Registry. It will stay in sync with your GitHub and BitBucket repository until you deactivate the Automated Build.If you want to see the status of your Automated Builds, you can go to your Automated Builds page on the Docker Hub, and it will show you the status of your builds and their build history.Once you've created an Automated Build you can deactivate or delete it. You cannot, however, push to an Automated Build with the docker push command. You can only manage it by committing code to your GitHub or BitBucket repository.You can create multiple Automated Builds per repository and configure them to point to specificDockerfile's or Git branches.Build TriggersAutomated Builds can also be triggered via a URL on Docker Hub. This allows you to rebuild an Automated build image on demand.例如从docker hub pull一个官方image.
[root@db-172-16-3-221 lib]# docker pull postgres
[root@db-172-16-3-221 lib]# docker imagesREPOSITORY TAG IMAGE ID CREATED VIRTUAL SIZEpostgres 9.4-beta3 68b6ddf9ca08 42 hours ago 213.6 MBpostgres 9.4 68b6ddf9ca08 42 hours ago 213.6 MBpostgres 9.3 935836384c52 42 hours ago 212.9 MBpostgres 9 935836384c52 42 hours ago 212.9 MBpostgres 9.3.5 935836384c52 42 hours ago 212.9 MBpostgres latest 935836384c52 42 hours ago 212.9 MBpostgres 9.2 2a9ab0b9fa56 42 hours ago 212.7 MBpostgres 9.2.9 2a9ab0b9fa56 42 hours ago 212.7 MBpostgres 9.1.14 ee60947f6805 42 hours ago 212.1 MBpostgres 9.1 ee60947f6805 42 hours ago 212.1 MBpostgres 9.0.18 f29be88283f6 42 hours ago 211.5 MBpostgres 9.0 f29be88283f6 42 hours ago 211.5 MBpostgres 8 c57c14beb696 42 hours ago 211 MBpostgres 8.4 c57c14beb696 42 hours ago 211 MBpostgres 8.4.22 c57c14beb696 42 hours ago 211 MBpostgres 9.4-beta2 bf872395e1d4 2 weeks ago 213.6 MB使用inspect查看image的内容
[root@db-172-16-3-221 lib]# docker inspect postgres:9.3.5[{ "Architecture": "amd64", "Author": "", "Comment": "", "Config": { "AttachStderr": false, "AttachStdin": false, "AttachStdout": false, "Cmd": [ "postgres" ], "CpuShares": 0, "Cpuset": "", "Domainname": "", "Entrypoint": [ "/docker-entrypoint.sh" ], "Env": [ "PATH=/usr/lib/postgresql/9.3/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin", "LANG=en_US.utf8", "PG_MAJOR=9.3", "PG_VERSION=9.3.5-1.pgdg70+1", "PGDATA=/var/lib/postgresql/data" ], "ExposedPorts": { "5432/tcp": {} }, "Hostname": "39d2c877bc4f", "Image": "15d042248df39ca896223c9e75f0f4541996f2b52030f1f8e6619cf18f77e395", "Memory": 0, "MemorySwap": 0, "NetworkDisabled": false, "OnBuild": [], "OpenStdin": false, "PortSpecs": null, "StdinOnce": false, "Tty": false, "User": "", "Volumes": { "/var/lib/postgresql/data": {} }, "WorkingDir": "" }, "Container": "977043cde52cd15e070d71a67fbd8e2ec908af49123f3f773f71cda2061e9f44", "ContainerConfig": { "AttachStderr": false, "AttachStdin": false, "AttachStdout": false, "Cmd": [ "/bin/sh", "-c", "#(nop) CMD [postgres]" ], "CpuShares": 0, "Cpuset": "", "Domainname": "", "Entrypoint": [ "/docker-entrypoint.sh" ], "Env": [ "PATH=/usr/lib/postgresql/9.3/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin", "LANG=en_US.utf8", "PG_MAJOR=9.3", "PG_VERSION=9.3.5-1.pgdg70+1", "PGDATA=/var/lib/postgresql/data" ], "ExposedPorts": { "5432/tcp": {} }, "Hostname": "39d2c877bc4f", "Image": "15d042248df39ca896223c9e75f0f4541996f2b52030f1f8e6619cf18f77e395", "Memory": 0, "MemorySwap": 0, "NetworkDisabled": false, "OnBuild": [], "OpenStdin": false, "PortSpecs": null, "StdinOnce": false, "Tty": false, "User": "", "Volumes": { "/var/lib/postgresql/data": {} }, "WorkingDir": "" }, "Created": "2014-10-21T05:54:39.659381225Z", "DockerVersion": "1.2.0", "Id": "935836384c524aafc0ac1c05246002c9c93343f0b4283a34e77a5f92f97f9a7c", "Os": "linux", "Parent": "15d042248df39ca896223c9e75f0f4541996f2b52030f1f8e6619cf18f77e395", "Size": 0}docker下载的image会放到/var/lib/docker目录中(默认如此, 如果启动docker时使用-g指定其他目录的话, 那么会放到其他目录)
[root@db-172-16-3-221 docker]# lltotal 44drwx------ 2 root root 4096 Oct 22 10:59 containersdrwx------ 5 root root 4096 Oct 22 11:00 devicemapperdrwx------ 3 root root 4096 Oct 22 10:59 execdriverdrwx------ 102 root root 12288 Oct 23 07:42 graphdrwx------ 2 root root 4096 Oct 22 10:59 init-rw-r--r-- 1 root root 5120 Oct 22 10:59 linkgraph.db-rw------- 1 root root 1223 Oct 23 07:42 repositories-devicemapperdrwx------ 2 root root 4096 Oct 22 10:59 volumes
mkdir /data01/dockerln -s /data01/docker /var/lib/
service docker start
转载地址:http://tytdm.baihongyu.com/