溫馨提示×

溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊×
其他方式登錄
點擊 登錄注冊 即表示同意《億速云用戶服務條款》

安裝docker和laradoc要注意什么

發(fā)布時間:2021-06-24 11:50:46 來源:億速云 閱讀:151 作者:chen 欄目:大數據

本篇內容主要講解“安裝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,進入工作空間前,請確認環(huán)境已經啟動

docker-compose exec workspace bash 【報權限錯誤】,加參 --user=laradock

docker-compose exec --user=laradock workspace bash

會進入 /var/www 目錄

此時 可以執(zhí)行composer 和PHP命令。

如果之前env-example 開啟了node和yarn 也可執(zhí)行對應命令。

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 創(chuàng)建項目(這一種辦法即可)

在終端中運行 create-project 命令來安裝 Laravel:

composer create-project --prefer-dist laravel/laravel blog "5.8.*"

3. 使用composer創(chuàng)建laravel項目,http://silsuer.cn/2018/01/17/laravel-docker-env-windows/

------------------------------------------------------------------------------------------------

在本地電腦的虛擬機內使用composer一直報

[Composer\Downloader\TransportException] 錯誤,花了一整天的時間調整composer,估計是本地網絡過慢。

-----------------------------------------------------------------------------------------------------

只好從安裝的本地電腦能使用php artisan make:auth的環(huán)境,整體將本地電腦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要注意什么”有了更深的了解,不妨來實際操作一番吧!這里是億速云網站,更多相關內容可以進入相關頻道進行查詢,關注我們,繼續(xù)學習!

向AI問一下細節(jié)

免責聲明:本站發(fā)布的內容(圖片、視頻和文字)以原創(chuàng)、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯(lián)系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。

AI