美文网首页Docker容器
docker 安装以及配置

docker 安装以及配置

作者: 小简猫 | 来源:发表于2016-05-13 10:03 被阅读137次

    🐳 official docker 🔗
    or 🐳 website: 🔗 https://docs.docker.com/mac/

    ""Index""

    Start

    Step1: write a docker file

    Step 2: Build an image from your Dockerfile

    learn about the build process

    Start

    🐳 docker as the image or container to get and load the image from the internet or local, then save them into the docker in the docker.
    😆 for me, it is the database for image :P

    💻 My laptop is: 🍎 Mac air -- OS X EL Capitan -- Version 10.11.4

    official website

    If you see this picture, that means you are on the right track
    If you are the other version or other system, please 🖱️ click the orange text for "Linux" and "Windows" on the web

    just click continue

    Then install the program and 🖱️ click "continue" and then 🖱️ click "finish"

    Click Terminal

    Once you finish the installation, find your launchpad or open the "Finder" then find this image from the "application"
    🖱️ click the left whale terminal "Docker quic...art Terminal"

    memeda 🐳

    As this window is open, if you didn't see the text above, please wait a min (or more than a minute) 🐳 whale may takes some time to pass by your laptop
    🐳 。。 🐳 。。 🐳 。。 🐳 。。 🐳 。。 🐳 。。

    finish

    See? the whale is coming :) 🐳

    ⌨️ enter the code below:
    docker run hello-world

    🐳 docker run hello-world

    ⌨️ try again:P

    docker run hello-world
    
    let us start!

    Learn about the image and Container:

    docker run hello-world 
    

    ✏ docker: name of the program
    ✏ run: sub-comment; create and run the system "docker"
    ✏ hello-world: tell docker which image you prefer to put into the containers

    https://docs.docker.com/engine/userguide/

    🔗 user guide


    🐳 hub

    🖱️ find the search from the right top on the page

    hub Here is the box you need find whalesay

    ⬆️ enter the text below on the search box as above then 🖱️ click enter/return
    whalesay

    resource page

    link

    Find this row and select it https://hub.docker.com/r/docker/whalesay/

    From this page, you can find the way to help you load the image from the docker, there are thousands of images on the docker include some large company such as IBM, Google and other else. As you enter the web page, for example the whalesay, you can see the "how to use this image" for helping using the image in the terminal

    so...
    here is the code you need to enter to get the whalesay image (i am really confused what the expression the whale will say, let us take a look by enter the below code first 😃 )

    $ means the start on the terminal, you don't need to enter it within the terminal, if you see in the other place. In here, i prefer delete it and give you the code you need to enter in the code mode.

    docker run docker/whalesay cowsay boo
    
    whale say !!

    Here is what the terminal display after the "docker run docker/whalesay cowsay boo"

    oh, actually, you can see the boo on the left top which is different from the whale before...

    ..... it says:"boo"!!


    Now, we try to see what kinds of images we have so far in our own containers:

    docker images
    
    docker images

    There is two packages of images in the docker in your local, after we making sure that the 🐳 "whalesay" package

    docker run docker/whalesay cowsay boo-boo
    
    boo

    🐳 whale now is your guest and say boo to you


    Step1: write a docker file

    • open the whale terminal and let us start 😄

      mkdir mydockerbuild
      

    mkdir (make directory): create a new directory

    cd mydockerbuild
    
    • open the new created directory, cd means open in the terminal as you seen before (cheatsheet is on the bottom of the page )
    touch Dockerfile
    

    create a Dockerfile in the directory

    ls Dockerfile
    

    read the Dockerfile

     open -e Dockerfile
    

    There is another window coming out, here is the text file you can enter the text

    text file window

    Type the text below in the text file :

      FROM docker/whalesay:latest
    
    • FROM: the keyword to tell where does the image coming from and execute the action the image after from
    enter the text
    RUN apt-get -y update && apt-get install -y fortunes
    
    CMD /user/games/fortune -a | cowsay
    
    whole text

    then use the File>save or command -S to save the file

    run in terminal

    As you run in the terminal, you can see the text was shown.

    Step 2: Build an image from your Dockerfile

    cat Dockerfile
    

    cat: it is not the cat 🐱 , but the action of "CATCH" miao~~

    docker build -t docker-whale .
    
    successful built

    learn about the build process

    docker build -t docker-whale .
    
    docker build

    https://docs.docker.com/mac/step_four/


    Extra resources:

    1. terminal cheat sheet
    terminal.png

    相关文章

      网友评论

        本文标题:docker 安装以及配置

        本文链接:https://www.haomeiwen.com/subject/dpgprttx.html