Objective
Docker finally came out of the Mac version, hurriedly to download, installation steps, before the Mac version of the time to install Docker Toolbox, now directly download installation is good.
The way it's installed.
Status bar
Tips for Docker
At this point, you can enter the Docker command inside the terminal.
$ docker--version
Docker version 1.13.0-rc3, build 4d92237
$ docker-compose--version
Version 1.9.0, build 2585387
$ docker-machine--version
docker-machine version 0.9.0-rc2, build 7b19591
If you enter the Docker prompt in the terminal is command not found please add Docker to environment variable
Vim/etc/profile
last inserted Export Path=${path}:/usr/local/bin # # Docker command installed to this directory
Hello World
Docker Run Hello-world
It is mainly used to test whether the Docker is installed and can be used normally.
Hello World
docker images
Viewing mirrors that have already been downloaded
docker ps
View the containers that are running
docker ps -a
To view all running containers
View first-use containers
Remove mirrors and containers (in order to understand what mirroring is and what is a container, I think, mirroring is a computer that has nothing to do with shutting down, and a container is a computer that installs the software that is needed to run)
docker rm
Delete Container
docker rmi
Remove Mirror
docker rmi c54a2cc56cbb
The Hello-world mirror will be deleted.
docker rmi c5
Also deletes the Hello-world mirror image because C5 can represent a unique mirror image in your mirror list, Docker will help you to complete it automatically.
LAMP
Find the Ubuntu version inside hub.docker.com
Install Ubuntu
Docker pull Ubuntu # The Ubuntu version installed is 16.04
Docker pull ubuntu:14.04 # ubuntu 14.04 version
Enter Ubuntu container, install software
Docker run <image id>-i-t/bin/bash #-I synchronous input-t synchronous output-D continued
to run and then went into the familiar Ubuntu
installation vim apache2 MySQL php5 r Edis
apt-get Update
apt-get install vim
apt-get install
apache2 apt-get Install Apt-get install php5 libapache2-mod-php5 php5-gd php5-mysql apt-get install redis-server Php5-redis
Exit Exit Bash after Setup completes and the current container stops
If you add parameters at run time, -d
you can go through attach and exec again in the container.
Docker attach-i-T <container id>/bin/bash Docker exec-i-
t <container id>/bin/bash
Use docker ps -a
to view the current container
The containers we just finished need to be stored in a mirror image, or we need to install the software every time we use this container, use the commit
command
Docker commit-m "description" <container id> new_name
Again, docker images
you'll find that the images that you just submitted appears in the list.
Map local port to container Port map local folder to container folder
Docker run-itd-p 8989:80-v/users/php/wwwroot:/var/www/html 74b3eadeafea/bin/bash
-P Maps The local 8989 port to the container's 80 port
-V Map local folders to server Apache Default Web site Directory
Upload your own image to hub.docker.com.
First to docker.com registered account, a new REPOSITORY
Docker Login # Login Docker
docker tag <images id> <namespace>/<image name>:<version tag eg LATEST&G t;
Docker push <namsoace>/<image name> # Wait for the upload to be done
Upload tags.
Summarize
The above is the entire content of this article, I hope the content of this article for everyone's study or work can bring certain help, if you have questions you can message exchange.