もくじ
環境
- AWS
- Amazon Linux2
Laradockの入手
sudo curl -L https://github.com/docker/compose/releases/download/1.22.0/docker-compose-$(uname -s)-$(uname -m) -o /usr/local/bin/docker-compose sudo chmod +x /usr/local/bin/docker-compose 一度ログインし直す(重要) $ exit
$ sudo yum install -y docker $ sudo usermod -aG docker ${USER} sudo systemctl start docker sudo systemctl enable docker sudo systemctl status docker
$ sudo yum install -y git
mkdir laravel cd laravel mkdir sample_project git clone https://github.com/LaraDock/laradock.git cd laradock cp env-example .env
$ sudo vi .env # Point to the path of your applications code on your host APP_CODE_PATH_HOST=../ ↓変更 APP_CODE_PATH_HOST=../sample_project/
$ docker-compose up -d nginx mysql redis
laradock]$ docker ps CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES 1463f85feffb laradock_nginx "/bin/bash /opt/star…" About a minute ago Up About a minute 0.0.0.0:80->80/tcp, 0.0.0.0:443->443/tcp laradock_nginx_1 b6332840b23a laradock_php-fpm "docker-php-entrypoi…" About a minute ago Up About a minute 9000/tcp laradock_php-fpm_1 a7b737e776e3 laradock_workspace "/sbin/my_init" About a minute ago Up About a minute 0.0.0.0:2222->22/tcp laradock_workspace_1 e82cfa6e472c docker:dind "dockerd-entrypoint.…" About a minute ago Up About a minute 2375/tcp laradock_docker-in-docker_1 ad2d78b615fc laradock_redis "docker-entrypoint.s…" About a minute ago Up About a minute 0.0.0.0:6379->6379/tcp laradock_redis_1 d7fd8a7644e6 laradock_mysql "docker-entrypoint.s…" About a minute ago Up About a minute 0.0.0.0:3306->3306/tcp, 33060/tcp laradock_mysql_1
コンテナへのログイン
$ docker exec -it laradock_workspace_1 /bin/bash
プロジェクトの作成
root@a7b737e776e3:/var/www# composer create-project --prefer-dist laravel/laravel ./ コンテナ内部にログイン # chmod 777 -R storage/ # exit
http://IPアドレス/