zoukankan      html  css  js  c++  java
  • Tool-Docker-First exploration

    Tool-Docker-First exploration

    2020/11/30 00:19:00

    之前工作中接触过Docker,最近在笔记本上想装个Vm虚拟机用,就想着来试试Docker吧。

    1.Docker Hub Tutorial

    Docker Hub

    Get started by downloading Docker Desktop, and learn how you can build, tag and share a sample image on Hub.

    1. Download:

      Docker Desktop installer.exe

    2. Clone:

      git clone https://github.com/docker/doodle.git

    3. Build:

      cd doodlecheers2019 ; docker build -t cain95/cheers2019 .

      注:实测用了3000+s。

    4. Run:

      docker run -it --rm cain95/cheers2019

    5. Ship:

      docker login ; docker push cain95/cheers2019

    2.Docker 101 Tutorial

    101-Tutorial

    1. Docker Desktop

      Docker Desktop is a native application that delivers all of the Docker tools to your Mac or Windows Computer. 
      
      1.Open Docker Desktop. (Download here if you don't have it).
      2.Type the following command in your terminal: docker run -dp 80:80 docker/getting-started
      3.Open your browser to http://localhost
      4.Have fun!
      
    2. Play with Docker

      Play with Docker is an interactive playground that allows you to run Docker commands on a linux terminal, no downloads required.
      
      1.Log into https://labs.play-with-docker.com/ to access your PWD terminal
      2.Type the following command in your PWD terminal: docker run -dp 80:80 docker/getting-started:pwd
      3.Wait for it to start the container and click the port 80 badge
      4.Have fun!
      

    3. Windows Containers with Docker

    Windows Containers Basics

    First, make sure the Docker installation is working:

    docker version

    我的server是linux/amd64,不支持windows,尴尬。

    解决方法:任务栏右键whale,可以选择切换server为windows。[默认安装时是linux]

    Next, pull a base image that’s compatible with the evaluation build, re-tag it and do a test-run:

    docker pull microsoft/windowsservercore:10.0.14393.321 
    //提示error:xxx i/o timeout。
    //替换方案,去hub上找了个镜像:
    //[windows-servercore](https://hub.docker.com/_/microsoft-windows-servercore)
    //docker pull mcr.microsoft.com/windows/servercore:ltsc2019
    //docker run mcr.microsoft.com/windows/servercore:ltsc2019
    //拉取超时~,参考[配置Docker镜像加速](https://www.runoob.com/docker/docker-mirror-acceleration.html)
    //配置Docker镜像加速:
    //-网易:https://hub-mirror.c.163.com/
    //-阿里云:https://<你的ID>.mirror.aliyuncs.com  
    ///阿里云镜像获取地址:https://cr.console.aliyun.com/cn-hangzhou/instances/mirrors
    //-七牛云加速器:https://reg-mirror.qiniu.com
    //-Docker 官方加速器 https://registry.docker-cn.com (可能不能用了)
    //回到原有指令,3.738GB
    //2020/12/02 最后还是没下下来,真的放弃了,这是要让人用AWS来实现啊
    
    docker tag microsoft/windowsservercore:10.0.14393.321 microsoft/windowsservercore
    docker run microsoft/windowsservercore hostname
    

    Building and pushing Windows container images

    Pushing images to Docker Cloud requires a free Docker ID. Storing images on Docker Cloud is a great way to save build artifacts for later user, to share base images with co-workers or to create build-pipelines that move apps from development to production with Docker.

    Docker images are typically built with docker build from a Dockerfile recipe, but for this example, we’re going to just create an image on the fly in PowerShell.

    "FROM microsoft/windowsservercore `n CMD echo Hello World!" | docker build -t <docker-id>/windows-test-image -
    

    Test the image:

    docker run <docker-id>/windows-test-image
    Hello World!
    

    Login with docker login and then push the image:

    docker push <docker-id>/windows-test-image
    

    Images stored on Docker Cloud are available in the web interface and public images can be pulled by other Docker users in the Docker Store.

    4.Docker 命令大全

    转自runoobDocker-命令大全

    容器生命周期管理

    容器操作

    容器rootfs命令

    镜像仓库

    本地镜像管理

    info|version

    5.Docker 资源

    转自runoobDocker-资源汇总

  • 相关阅读:
    char 转string
    博客,记忆的图谱。
    history
    openstack Icehouse发布
    数据库常用命令
    nagios
    screen
    openstack 流量控制
    sublime 3
    磁盘类型
  • 原文地址:https://www.cnblogs.com/yongchao/p/14075506.html
Copyright © 2011-2022 走看看