Beginners install docker for mac and prepare php7.0 operating environment

Target person

What is docker?

Reference article

Install Docker on Mac (Update: 2019/7/13)

account registration

Official site

docker version check

docker version

Double-click Docker.dmg to start the install process. When the installation completes and Docker starts, the whale in the top status bar shows that Docker is running, and accessible from a terminal.

git version check

git version

What is docker?

docker is container management software. I installed it, so let's use it.

Try using docker commands

pull nginx

cmd


docker run -d -p 80:80 --name {Container name} nginx

Stop running nginx

cmd


docker container stop {Container name}

Start nginx that is running

cmd


docker container start {Container name}

View the list of running containers

cmd


docker container ls

cmd


docker container ls -a

Delete container

cmd


docker container rm {Container name}

Delete image

cmd


docker image rm {ID}

Questions so far

――What is nginx? --What is an image?

Reference url

[Introduction] What is Nginx (Engine X)? Differences from Apache and initial settings Tutorial aimed at understanding Docker images

What is nginx?

Suitable for static content. Apache is suitable for dynamic content such as video processing.

What is an image?

A Docker image is made up of multiple image layers that have a parent-child relationship. The image layer is read-only. Docker uses technology that integrates file and directory information from multiple image layers into one.

What is a container?

The Docker container is the execution part of the virtual environment created based on the Docker image.

Reference URL

Building PHP 7.0 x Apache environment with Docker

Use Apache instead of nginx! The business is Apache.

Download the php7.0 image from the registry

cmd


docker run -d -p 80:80  --name php70-apache  php:7.0-apache

php70-Login to apache

cmd


docker container exec -ti php70-apache bash

Confirmation of operation of PHP 7.0 and Apache

cmd


echo '<?php phpinfo();' > index.php

Synchronize directories between host and container

First, delete the container you created earlier.

Delete container

cmd


#Stop container
docker container stop php70-apache
#Delete container
docker container rm php70-apache

Container to sync new directories

cmd


docker run -d -p 80:80 -v /Users/[user name]/docker/php70-apache/www:/var/www/html --name php70-apache php:7.0-apache

php70-Login to apache

cmd


docker container exec -ti php70-apache bash

Confirmation of operation of PHP 7.0 and Apache

cmd


echo '<?php phpinfo();' > index.php

Operation check of [localhost](http: //localhost/index.php)

Recommended Posts

Beginners install docker for mac and prepare php7.0 operating environment
Environment construction with Docker for beginners
Prepare a transcendentally simple PHP & Apache environment on Mac with Docker
Install Docker Desktop for Mac with Homebrew
Install Docker and create Java runtime environment
Let's install Docker on Windows 10 and create a verification environment for CentOS 8!
Just install Laravel8 on docker in PHP8 environment
Install an older version of Docker for Mac
Prepare a scraping environment with Docker and Java
Prepare the environment for java11 and javaFx with Ubuntu 18.4
How to quit Docker for Mac and build a Docker development environment with Ubuntu + Vagrant
[PHP8] Install and use PECL YAML function (YAML parser) with Docker
[For beginners] Install JDK + Eclipse on Mac (without Pleiades All-in-One)
(For beginners) [Rails] Install Devise
Install docker, docker-compose for debin10
[Introduction] Installation of Docker Desktop for Mac for the first time and setup of virtual environment construction of CentOS
Install metrics-server with Helm on Kubernetes that comes with Docker for Mac
Rails 6 (API mode) + MySQL Docker environment creation by docker-compose (for Mac)
How to install JMeter for Mac
Java for beginners, expressions and operators 1
Java for beginners, expressions and operators 2
[Folio LSP] Roughly Docker (for beginners)
Install laravel/Dusk in docker environment (laravel6)
Build Java development environment (for Mac)
Jupyter's Docker environment for running TensorFlow
[Java & SpringBoot] Environment Construction for Mac
Challenge to install WSL2 and docker
Classes and instances Java for beginners
Docker For Mac Slow: Countermeasure II
Install Java development environment on Mac
How to build a Ruby on Rails environment using Docker (for Docker beginners)
Creating a java web application development environment with docker for mac part1
[Docker] How to create a virtual environment for Rails and Nuxt.js apps
(For beginners) [Rails] Time saving tech! How to install and use slim
Create a java web application development environment with docker for mac part2
[For beginners] Laravel Docker AWS (EC2) How to easily deploy Web application (PHP) from 0 (free) ②-Docker development environment construction-
Install docker and docker-compose on Alpine Linux
How to install Play Framework 2.6 for Mac
Building Rails 6 and PostgreSQL environment with Docker
Kind @ Mac in Docker and vctl container
Laravel development environment construction with Docker (Mac)
Getting Started with Docker for Mac (Installation)
[For beginners] Difference between Java and Kotlin
Prepare the security check environment for Rails 6
What is Java and Development Environment (MAC)
Download and install Eclipse (Java) (Mac version)
Lightweight PHP 7.4 development environment created with Docker
Building an environment for WordPress, MySQL and phpMyAdmin with Docker Compose on EC2