🐳 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 websiteIf 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
Then install the program and 🖱️ click "continue" and then 🖱️ click "finish"
Click TerminalOnce 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"
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
🐳 。。 🐳 。。 🐳 。。 🐳 。。 🐳 。。 🐳 。。
See? the whale is coming :) 🐳
⌨️ enter the code below:
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
🖱️ 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
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 windowType 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
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 terminalAs 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:
- terminal cheat sheet
网友评论