本篇内容主要讲解“安装docker和laradoc要注意什么”,感兴趣的朋友不妨来看看。本文介绍的方法操作简单快捷,实用性强。下面就让小编来带大家学习“安装docker和laradoc要注意什么”吧!
安装最新的docker-compose
1,centos7.0 安装的日志
111 sudo yum install -y yum-utils device-mapper-persistent-data lvm2
798 yum-config-manager --add-repo https://mirrors.ustc.edu.cn/docker-ce/linux/centos/docker-ce.repo
799 docker-compose --version
802 yum remove docker-compose
803 sudo curl -L "https://github.com/docker/compose/releases/download/1.23.1/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
804 chmod +x /usr/local/bin/docker-compose
805 docker-compose --version
807 chmod +x /usr/local/bin/docker-compose
810 which docker-compose
811 /usr/local/bin/docker-compose
815 rm /usr/bin/docker-compose -rf
817 ln -s /usr/local/bin/docker-compose /usr/bin/docker-compose
818 docker-compose
819 docker-compose up caddy postgres
823 ps -ef | grep 80
##下面是原来安装了bt的,可以忽略
824 /etc/init.d/bt stop
825 /etc/init.d/nginx stop
826 /etc/init.d/php-fpm-56 stop
##从这开始始
827 docker-compose up caddy postgres
2,进入工作空间前,请确认环境已经启动
docker-compose exec workspace bash 【报权限错误】,加参 --user=laradock
docker-compose exec --user=laradock workspace bash
会进入 /var/www 目录
此时 可以执行composer 和PHP命令。
如果之前env-example 开启了node和yarn 也可执行对应命令。
3,安装notadd (一直没有安装成功)
(注:很多文档说下载是git clone https://github.com/notadd/notadd.git,但是找不到public文件。后来看到有https://gitee.com/stamhe/notadd/ ,就从这下载了)
$ cd notadd $ composer install $ php notadd vendor:publish --force
------------------------------------------------------------------------------------------------------------
composer Content-Length mismatch 坑
------------------------------------------------------------------------------------------------------------
[root@localhost docker]# docker-compose exec --user=laradock workspace bash
laradock@f38202628d46:/var/www$ composer install
Composer could not find a composer.json file in /var/www
To initialize a project, please create a composer.json file as described in the https://getcomposer.org/ "Getting Started" section
laradock@f38202628d46:/var/www$ cd notadd
laradock@f38202628d46:/var/www/notadd$ composer install
Loading composer repositories with package information
Updating dependencies (including require-dev)
.... 时间是很长,估计5分钟
composer update 出现如下错误:
[Composer\Downloader\TransportException] Content-Length mismatch
解决:
更换源:
composer config repo.packagist composer https://packagist.phpcomposer.com (坏了)
composer config -g repo.packagist composer https://mirrors.aliyun.com/composer
如果更换了源,还是不通过。就表示是网速问题。
---------------------------------------------------------------------------------
[root@localhost docker]# docker-compose images
ERROR: Couldn't connect to Docker daemon at http+docker://localhost - is it running?
..........
If it's at a non-standard location, specify the URL with the DOCKER_HOST environment variable.
[root@localhost docker]# systemctl start docker.service
[root@localhost docker]# docker-compose images
docker mysql 的坑处理
[root@localhost docker]# docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
749b4031b2da e12a2860ec4a "/bin/sh -c 'if [ ${…" 13 minutes ago Up 13 minutes frosty_roentgen
78dd491ef5c1 laradock_mysql "docker-entrypoint.s…" 33 minutes ago Up 11 minutes 0.0.0.0:3306->3306/tcp, 33060/tcp laradock_mysql_1_b66ee05935fb
[root@localhost docker]#
[root@localhost docker]# docker exec -it 78dd491ef5c1 bash
root@78dd491ef5c1:/#
root@78dd491ef5c1:/# mysql
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)
root@78dd491ef5c1:/# mysql -uroot -proot
mysql: [Warning] Using a password on the command line interface can be insecure.
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 9
Server version: 8.0.18 MySQL Community Server - GPL
Copyright (c) 2000, 2019, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql> exit;
这使用windows 客户端工具mysql Sqlyog连接报1251错误。处理见:https://blog.csdn.net/qq_36068954/article/details/80175755
[root@localhost docker]# docker exec -it 78dd491ef5c1 bash
root@78dd491ef5c1:/# mysql -uroot -p
mysql> use mysql;
mysql> ALTER USER 'root'@'%' IDENTIFIED WITH mysql_native_password BY 'password';
Query OK, 0 rows affected (0.01 sec)
mysql> ALTER USER 'root'@'%' IDENTIFIED BY 'root' PASSWORD EXPIRE NEVER;
Query OK, 0 rows affected (0.00 sec)
mysql> FLUSH PRIVILEGES;
Query OK, 0 rows affected (0.00 sec)
修改完成,用sqlyog测试ip:192.168.137.103 root ps:root 端口:3306 ,通过成功。
-----------------------------------------------------------------------------------------------------
在laravel使用php artisan make:auth,提示未定义。这有可能使用了git clone安装版本不对。后面通过 Laravel 安装器
-----------------------------------------------------------------------------------------------------
#docker-compose exec --user=laradock workspace bash
laradock@86eb8724d279:/var/www/laravel$ composer config -g repo.packagist composer https://mirrors.aliyun.com/composer
laradock@86eb8724d279:/var/www/laravel$ composer update
Loading composer repositories with package information
------------------------------------------------------------------------------------------------
首先,通过使用 Composer 安装 Laravel 安装器:
composer global require laravel/installer
-----------------------------------------------------------------------------------------------------
安装laravel5.8中文文档:https://learnku.com/docs/laravel/5.8/installation/3879
选择通过 Composer 创建项目(这一种办法即可)
在终端中运行 create-project 命令来安装 Laravel:
composer create-project --prefer-dist laravel/laravel blog "5.8.*"
3. 使用composer创建laravel项目,http://silsuer.cn/2018/01/17/laravel-docker-env-windows/
------------------------------------------------------------------------------------------------
在本地电脑的虚拟机内使用composer一直报
[Composer\Downloader\TransportException] 错误,花了一整天的时间调整composer,估计是本地网络过慢。
-----------------------------------------------------------------------------------------------------
只好从安装的本地电脑能使用php artisan make:auth的环境,整体将本地电脑laravel目录打包为zip,放进虚拟机内。
使用
#docker-compose exec --user=laradock workspace bash
laradock@86eb8724d279:/var/www/laravel$ php artisan make:auth
The [auth/login.blade.php] view already exists. Do you want to replace it? (yes/no) [no]:
> n
由于原来有此文件,上面表示成功了。
参考:
https://gitee.com/stamhe/notadd/
https://learnku.com/articles/15197/laradock-portal-configuration
到此,相信大家对“安装docker和laradoc要注意什么”有了更深的了解,不妨来实际操作一番吧!这里是亿速云网站,更多相关内容可以进入相关频道进行查询,关注我们,继续学习!
免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。