1. Login to the virtual machine via vagrant SSH
2. Install Docker through the Yum command in the virtual machine
3. Check Docker installation success with docker-v
4. Open The Docker accelerator
Curl-ssl Https://get.daocloud.io/daotools/set_mirror. sh | SH -s http://68abbefd. m . Daocloud.io
then restart Docker (service docker restart)
Build nginx+php development Environment
Key point: Mapped files must be written correctly
1.Su root Log in as Administrator first
2.nginx and PHP Environment Build:http://www.tuicool.com/articles/AVZFZ3m
3.docker Construction Considerations:
- After downloading the nginx image and the php image.
- deploy the PHP image First
(Docker run-p 9000:9000--name php7--restart=always-v/vagrant/app/www:/var/www/html-privileged=true-d ph P:7.1.0-FPM) PS:/vagrant/app/www is the address of the virtual host --restart=always indicates the boot automatically
- get the corresponding container IP address via Docker inspect PHP7
- Deploying nginx containers with nginx images
(Docker run-p 80:80-name nginx-v/vagrant/app/www:/usr/share/nginx/html-v/vagrant/app/logs:/var/log/nginx -V/VAGRANT/APP/NGINX/CONF.D:/ETC/NGINX/CONF.D--privileged=true-d nginx)
- Modify /vagrant/app/nginx/conf.d The following default.conf file
- Restart Nginx container (docker restart Nginx)
Docker Issues
1. handling slow downloads via Docker pull
Turn on accelerator execution
Curl-ssl Https://get.daocloud.io/daotools/set_mirror. sh | SH -s http://68abbefd. m . Daocloud.io
then restart Docker
2.docker Related Information
Docker command http://udn.yyuap.com/doc/docker_practice/appendix_repo/nginx.html
Docker Chinese site http://www.docker.org.cn/forum/usage.html
Docker Image installation http://www.runoob.com/docker/docker-install-mysql.html
installation of PHP extensions
installing the zip extension
1. Implementation
echo "@community http://nl.alpinelinux.org/alpine/edge/community" >>/etc/apk/repositories
2. Implementation
APK--update Add [email protected]
PHP container installed via Docker pull php:5.6
Expansion Eg:docker-php-ext-install Redis with docker-php-ext-install installation
(PS: If error, you need to compile and install PHP extension)
To compile the specific steps for installing the PHP extension:
perform docker exec-it php5.6/bin/sh into php5.6 container
2. go to the PHP installation directory
3. If you cannot find the php.ini file through find/|grep php.ini , proceed as follows
4.
5. After you restart php , The location of the php.ini will be out .
6. start installing PHP Extensions
- Execute cd/usr/src/php/ext for php Extension directory (in https://pecl.php.net to find the corresponding version of the extension)
- wget https://pecl.php.net/get/redis-3.1.2.tgz
- TAR-ZXVF redis-3.1.2.tgz
- Mv redis-3.1.2.tgz Redis
- Docker-php-ext-install Redis
- After restarting PHP , thephp extension installation is complete.
Error compiling when installing Gearman extension:configure:error:Please Install Libgearman
Apt-get Install Libgearman-dev if no execution apt-get update is found
Xdebug Configuration
1. After the installation completes the Xdebug extension, configure the xdebug
[XDebug]
Zend_extension=xdebug.so
Xdebug.auto_trace = 0
Xdebug.remote_autostart = 1
Xdebug.show_exception_trace = 0
xdebug.remote_enable = 1
Xdebug.remote_connect_back = 1
Xdebug.remote_host = 192.168.33.3 (ps: IP address for request access )
Xdebug.remote_port = 9000
Xdebug.idekey = Phpstorm
Xdebug.remote_handler = DBGP
Xdebug.profiler_enable_trigger = 0
xdebug.profiler_enable = 0
Xdebug.collect_vars = 1
Xdebug.collect_return = 1
Xdebug.collect_params = 1
Build Docker in Linux