Docker 1.7.0已发布( 更改日志 ),因此有时间更新Docker主机,CLI和其他工具。

Docker 1.7.0

Docker Host在Docker Machine内运行,因此需要对其进行升级。 必须停止机器,否则会出现以下错误:

Error: machine must be running to upgrade.

因此,通过以下方式启动机器:

>docker-machine start mymachine
Starting VM...

然后将计算机升级为:

> docker-machine upgrade mymachine
Stopping machine to do the upgrade...
Upgrading machine mymachine...
Downloading https://github.com/boot2docker/boot2docker/releases/download/v1.7.0/boot2docker.iso to /Users/arungupta/.docker/machine/cache/boot2docker.iso...
Starting machine back up...
Starting VM...

无论如何,机器都已停止执行升级,因此启动机器的需求似乎是多余的( #1399 )。

升级主机将更新.docker/machine/cache/boot2docker.iso 。 先前创建的任何计算机都会将boot2docker.iso缓存在.docker/machine/machines/<MACHINE-NAME> ,因此它们将继续使用相同版本进行引导。

Docker CLI

将Docker CLI更新为:

curl https://get.docker.com/builds/Darwin/x86_64/docker-latest > /usr/local/bin/docker

现在docker version显示以下输出:

> docker version
Client version: 1.7.0
Client API version: 1.19
Go version (client): go1.4.2
Git commit (client): 0baf609
OS/Arch (client): darwin/amd64
Server version: 1.7.0
Server API version: 1.19
Go version (server): go1.4.2
Git commit (server): 0baf609
OS/Arch (server): linux/amd64

请注意,此处显示了客户端API版本(1.7.0)和服务器API版本(1.7.0)。

如果仅更新CLI而不更新Docker主机,则会显示以下错误消息:

Error response from daemon: client and server don't have same version (client : 1.19, server: 1.18)

此错误消息显示客户端CLI和计算机中运行的Docker主机之间的版本不匹配。 如果活动机器是几天前使用较旧的boot2docker.iso创建的,则通常会发生这种情况。 似乎没有办法直接找出当前正在使用的确切版本( #1398 )。

新客户端似乎无法与旧服务器( #14077 )进行通讯,因此主机需要升级。 有一个建议可以覆盖客户端的API版本( #11486 ),但是目前尚无此修补程序的ETA。 因此,唯一的选择是升级Docker计算机,然后将其升级到最新版本的Docker。

因此,升级CLI还需要升级计算机。

以下是Docker CLI支持的选项:

> docker --help
Usage: docker [OPTIONS] COMMAND [arg...]

A self-sufficient runtime for linux containers.

Options:

  -D, --debug=false                                              Enable debug mode
  -d, --daemon=false                                             Enable daemon mode
  -H, --host=[]                                                  Daemon socket(s) to connect to
  -h, --help=false                                               Print usage
  -l, --log-level=info                                           Set the logging level
  --tls=false                                                    Use TLS; implied by --tlsverify
  --tlscacert=~/.docker/machine/machines/microservices/ca.pem    Trust certs signed only by this CA
  --tlscert=~/.docker/machine/machines/microservices/cert.pem    Path to TLS certificate file
  --tlskey=~/.docker/machine/machines/microservices/key.pem      Path to TLS key file
  --tlsverify=true                                               Use TLS and verify the remote
  -v, --version=false                                            Print version information and quit

Commands:
    attach    Attach to a running container
    build     Build an image from a Dockerfile
    commit    Create a new image from a container's changes
    cp        Copy files/folders from a container's filesystem to the host path
    create    Create a new container
    diff      Inspect changes on a container's filesystem
    events    Get real time events from the server
    exec      Run a command in a running container
    export    Stream the contents of a container as a tar archive
    history   Show the history of an image
    images    List images
    import    Create a new filesystem image from the contents of a tarball
    info      Display system-wide information
    inspect   Return low-level information on a container or image
    kill      Kill a running container
    load      Load an image from a tar archive
    login     Register or log in to a Docker registry server
    logout    Log out from a Docker registry server
    logs      Fetch the logs of a container
    pause     Pause all processes within a container
    port      Lookup the public-facing port that is NAT-ed to PRIVATE_PORT
    ps        List containers
    pull      Pull an image or a repository from a Docker registry server
    push      Push an image or a repository to a Docker registry server
    rename    Rename an existing container
    restart   Restart a running container
    rm        Remove one or more containers
    rmi       Remove one or more images
    run       Run a command in a new container
    save      Save an image to a tar archive
    search    Search for an image on the Docker Hub
    start     Start a stopped container
    stats     Display a stream of a containers' resource usage statistics
    stop      Stop a running container
    tag       Tag an image into a repository
    top       Lookup the running processes of a container
    unpause   Unpause a paused container
    version   Show the Docker version information
    wait      Block until a container stops, then print its exit code

Run 'docker COMMAND --help' for more information on a command.
machines> docker events --help

Usage: docker events [OPTIONS]

Get real time events from the server

  -f, --filter=[]    Filter output based on conditions provided
  --help=false       Print usage
  --since=           Show all events created since timestamp
  --until=           Stream events until this timestamp

Docker机器0.3.0

这很简单:

curl -L https://github.com/docker/machine/releases/download/v0.3.0/docker-machine_darwin-amd64 > /usr/local/bin/docker-machine

有很多新功能 ,包括针对Red Hat Enterprise Linux 7.0的实验性预配器。

版本显示为:

> docker-machine --version
docker-machine version 0.3.0 (0a251fe)

命令的完整列表为:

> docker-machine --help
Usage: docker-machine [OPTIONS] COMMAND [arg...]

Create and manage machines running Docker.

Version: 0.3.0 (0a251fe)

Author:
  Docker Machine Contributors - <https://github.com/docker/machine>

Options:
  --debug, -D						Enable debug mode
  -s, --storage-path "/Users/arungupta/.docker/machine"	Configures storage path [$MACHINE_STORAGE_PATH]
  --tls-ca-cert 					CA to verify remotes against [$MACHINE_TLS_CA_CERT]
  --tls-ca-key 						Private key to generate certificates [$MACHINE_TLS_CA_KEY]
  --tls-client-cert 					Client cert to use for TLS [$MACHINE_TLS_CLIENT_CERT]
  --tls-client-key 					Private key used in client TLS auth [$MACHINE_TLS_CLIENT_KEY]
  --native-ssh						Use the native (Go-based) SSH implementation. [$MACHINE_NATIVE_SSH]
  --help, -h						show help
  --version, -v						print the version
  
Commands:
  active		Print which machine is active
  config		Print the connection config for machine
  create		Create a machine
  env			Display the commands to set up the environment for the Docker client
  inspect		Inspect information about a machine
  ip			Get the IP address of a machine
  kill			Kill a machine
  ls			List machines
  regenerate-certs	Regenerate TLS Certificates for a machine
  restart		Restart a machine
  rm			Remove a machine
  ssh			Log into or run a command on a machine with SSH.
  scp			Copy files between machines
  start			Start a machine
  stop			Stop a machine
  upgrade		Upgrade a machine to the latest version of Docker
  url			Get the URL of a machine
  help, h		Shows a list of commands or help for one command
  
Run 'docker-machine COMMAND --help' for more information on a command.

Docker Compose 1.3.0

Docker Compose可以更新为1.3.0,如下所示:

curl -L https://github.com/docker/compose/releases/download/1.3.0/docker-compose-`uname -s`-`uname -m` > /usr/local/bin/docker-compose
chmod +x /usr/local/bin/docker-compose

版本显示为:

> docker-compose --version
docker-compose version: 1.3.0
CPython version: 2.7.9
OpenSSL version: OpenSSL 1.0.1j 15 Oct 2014

需要注意的两个要点:

  • 至少需要Docker 1.6.0
  • Compose 1.2 发生了重大更改 ,因此您需要删除并重新创建容器,或者迁移它们。幸运的是,可以使用docker docker-compose migrate-to-labels migration docker-compose migrate-to-labels将Compose 1.3.0之前的容器迁移到最新格式。 这将重新创建带有标签的容器。

在Docker Compose to Orchestrate Containers中了解更多信息。

Docker Swarm 0.3.0

从此博客开始,Docker Swarm 0.3.0 RC3可用。 使用Docker Swarm进行集群化很好地介绍了Docker Swarm,可用于开始使用最新的Docker Swarm版本。

自0.2.0起已修复了34个问题,但自0.2.0 f或发布候选版本以来的提交通知似乎未显示任何重大更改。

有关每个Docker组件的更多详细博客将在后续博客中共享。

请享用!

翻译自: https://www.javacodegeeks.com/2015/06/docker-1-7-0-docker-machine-0-3-0-docker-compose-1-3-0-docker-swarm-0-3-0.html