• mac下docker使用笔记



    安装docker
    https://docs.docker.com/mac/

    启动docker环境
    launchpad -> Docker Quickstart Terminal

                            ##         .

                      ## ## ##        ==

                   ## ## ## ## ##    ===

               /"""""""""""""""""\___/ ===

          ~~~ {~~ ~~~~ ~~~ ~~~~ ~~~ ~ /  ===- ~~~

               \______ o           __/

                             __/

                  \____\_______/

    docker is configured to use the default machine with IP 192.168.99.101

    docker is configured to use the default machine with IP 192.168.99.100
    For help getting started, check out the docs at https://docs.docker.com

    查看已有虚拟机环境
    wei:xcp_esms (develop)admin$ docker-machine ls
    NAME ACTIVE DRIVER STATE URL SWARM DOCKER ERRORS
    default * virtualbox Running tcp://192.168.99.101:2376 v1.10.1
    dev - virtualbox Running tcp://192.168.99.100:2376 Unknown Unable to query docker version: Get https://192.168.99.100:2376/v1.15/version: x509: certificate is valid for 192.168.99.101, not 192.168.99.100

    删除docker虚拟机
    wei:xcp_esms (develop)admin$ docker-machine rm dev
    About to remove dev
    Are you sure? (y/n): y
    Successfully removed dev

    创建docker虚拟机
    wei:xcp_esms (develop)admin$ docker-machine create --driver virtualbox --engine-insecure-registry 192.168.40.73:5001 dev
    Running pre-create checks...

    启动docker虚拟机
    wei:xcp_esms (develop)admin$ docker-machine start dev
    Starting "dev"...
    Machine "dev" is already running.
    wei:xcp_esms (develop)admin$ docker-machine env dev
    export DOCKER_TLS_VERIFY="1"
    export DOCKER_HOST="tcp://192.168.99.102:2376"
    export DOCKER_CERT_PATH="/Users/admin/.docker/machine/machines/dev"
    export DOCKER_MACHINE_NAME="dev"
    # Run this command to configure your shell:
    # eval $(docker-machine env dev)

    查看docker虚拟机运行信息
    wei:xcp_esms (develop)admin$ eval $(docker-machine env dev)


    查看docker镜像
    wei:xcp_esms (develop)admin$ docker images
    REPOSITORY TAG IMAGE ID CREATED SIZE

    获取镜像
    wei:xcp_esms (develop)admin$ docker pull 192.168.40.73:5001/django:1.8.7
    1.8.7: Pulling from django
    5f70bf18a086: Pull complete
    00b3806ef847: Pull complete
    a9e0e5075443: Pull complete
    f51da0171fb8: Pull complete
    94cc93826def: Pull complete
    f8c763ed9bc8: Pull complete
    Digest: sha256:bf494210a1a42501c73c307113864e3e693aac8ed6d21c008d7c2082c0c65eee
    Status: Downloaded newer image for 192.168.40.73:5001/django:1.8.7

    查看本地镜像
    wei:xcp_esms (develop)admin$ docker images
    REPOSITORY TAG IMAGE ID CREATED SIZE
    192.168.40.73:5001/django 1.8.7 e0a79536098c 11 hours ago 522.1 MB

    运行django项目
    1)将本地路径映射到docker容器 /Users/admin/git/dj18/pad_math2_api:/code
    2)在docker容器中运行服务 192.168.40.73:5001/django:1.8.7 python /code/esms/manage.py runserver 0.0.0.0:8080
    wei:xcp_esms (develop)admin$ docker run -it --rm --net=host -v /Users/admin/git/dj18/pad_math2_api:/code 192.168.40.73:5001/django:1.8.7 python /code/esms/manage.py runserver 0.0.0.0:8080
    Performing system checks...

    System check identified no issues (0 silenced).
    May 05, 2016 - 20:28:08
    Django version 1.8.7, using settings 'esms.settings'
    Starting development server at http://0.0.0.0:8080/
    Quit the server with CONTROL-C.

  • 相关阅读:
    AJAX初识
    PE文件---导入表,导出表
    PE文件学习(基础)
    Android so(ELF)文件解析
    安卓加固方案从落地加载到类指令抽取编写报告
    安卓逆向从0到1学习总结
    DEX文件解析--7、类及其类数据解析(完结篇)
    网络设备配置--10、利用ACL配置访问控制
    网络设备配置--9、利用ppp协议实现点对点认证
    网络设备配置--8、利用ospf配置动态路由
  • 原文地址:https://www.cnblogs.com/weiok/p/5503883.html
Copyright © 2020-2023  润新知