• swarm搭建


    安装docker engine
    docker-machine create --driver=virtualbox vbox-test
    (可以下载boot2docker.iso放到对应目录,再运行此命令,跳过命令的下载过程)

    docker-machine启动关闭

    docker-machine start vbox-test
    docker-machine stop vbox-test

    ssh虚拟机

    docker-machine ssh vbox-test

    设置环境变量

    docker-machine env --shell fish vbox-test
    --根据提示 执行环境变量设置命令, 如: eval (docker-machine env --shell fish vbox-test)

    验证环境变量设置

    env | grep DOCKER

    [optional] docker-machine env --no-proxy vbox-test

    在docker engine上创建运行一个container
    docker run busybox echo hello world

    build a image, in the path same with Dockerfile

    docker build -t george/hello_docker:v1.0 .

    docker image ls

    run in attach mode

    docker run -p 4000:80 george/hello_docker:v1.0

    run in detach mode

    docker run -d -p 4000:80 george/hello_docker:v1.0

    docker container ls

    查看docker容器日志

    docker logs [OPTIONS] CONTAINER

    在宿主上交互式进入container的bash命令行

    docker exec -it /bin/bash

    在宿主上交互式执行container内的命令

    docker exec -it -w /root ubuntu_bash pwd

    提交container为image

    docker commit myfistcommit:v1.1

    docker container stop

    remove a container

    docker rm

    docker pull

    docker swarm init

    run a stack

    docker stack deploy -c docker-compose.yml firstcompose

    get the services

    docker service ls

    all services associated with the stack

    docker stack services firstcompose

    the tasks for your service

    docker service ps firstcompose_web

    view the logs of a service

    docker service logs [OPTIONS] SERVICE|TASK

    tasks of a stack

    docker stack ps firstcompose

    update the app, eg: scale the app, etc.

    docker stack deploy -c docker-compose.yml firstcompose

    Take the app down

    docker stack rm firstcompose

    Take down the swarm

    docker swarm leave --force

    创建machine

    docker-machine create --driver virtualbox vbox-vm2

    查看所有docker machine

    docker-machine ls

    init and become a manager

    docker-machine ssh vbox-vm2 "docker swarm init --advertise-addr <vbox-vm2's ip>"

    join as a worker

    docker swarm join --token : eg: docker-machine ssh vbox-test "docker swarm join --token SWMTKN-1-0x18fi7z7hajig78t1h0argt3iuec5qa3v4sy8ttofn1jmqh5w-chead4d793va4k0zo9jcm6jyu 192.168.99.101:2377"

    docker client连到manager

    查看所有node

    docker node ls

    发布app到swarm

    docker stack deploy -c docker-compose.yml firstswarmapp

    查看swarm上的services

    docker stack ps firstswarmapp

    Take the app down

    docker stack rm firstswarmapp

    离开swarm

    docker-machine ssh vbox-test "docker swarm leave"
    docker-machine ssh vbox-vm2 "docker swarm leave --force"

    显示不全,未验证???

    sudo docker exec -it -e LINES=$(tput lines) -e COLUMNS=$(tput cols) mysql_1 /bin/bash

  • 相关阅读:
    List和Dictionary互转
    table html
    华为解锁BL
    安卓小米系统开发一些适配问题
    02布局总结
    02表格布局
    02Framelayout:帧布局
    02线性布局
    02相对布局
    01安卓像素 dpi 、 dip 、分辨率、屏幕尺寸、px、density 关系以及换算
  • 原文地址:https://www.cnblogs.com/niulang85/p/12493185.html
Copyright © 2020-2023  润新知