将标准灯具安装转换为Docker?
我正在尝试学习Docker,并将下面我一直使用的灯组安装转换为Docker:将标准灯具安装转换为Docker?,docker,lamp,php-7,Docker,Lamp,Php 7,我正在尝试学习Docker,并将下面我一直使用的灯组安装转换为Docker: # Install Apache $ sudo apt-get install apache2 # Install PHP (PHP7) $ sudo apt-get update $ sudo apt-get install php7.0-mysql php7.0-curl php7.0-json php7.0-cgi php7.0 libapache2-mod-php7 # I
# Install Apache
$ sudo apt-get install apache2
# Install PHP (PHP7)
$ sudo apt-get update
$ sudo apt-get install php7.0-mysql php7.0-curl php7.0-json php7.0-cgi php7.0 libapache2-mod-php7
# Install PHP Curl
sudo apt-get install php-curl
# Install MySQL
$ sudo apt-get install mysql-server mysql-client
$ sudo systemctl status mysql
# Manage MySQL Databases (Optional)
$ sudo apt-get install phpmyadmin
Open terminal, and type:
$ sudo nano /etc/apache2/apache2.conf
Add the following line at the end:
include /etc/phpmyadmin/apache.conf
Save and Exit. Restart apache service:
$ sudo systemctl restart apache2
# Edit config & change html directory
The document root was set to /var/www/html. It was configured in the following file:
/etc/apache2/sites-available/000-default.conf
So just do:
$sudo nano /etc/apache2/sites-available/000-default.conf
and change the following line to what you want:
DocumentRoot /var/www
Also:
$ sudo gedit /etc/apache2/apache2.conf
Find:
<Directory /var/www/>
Options Indexes FollowSymLinks
AllowOverride All
Require all granted
</Directory>
Change `/var/www/html` to your preferred directory: `/var/www/`
Restart:
$ sudo /etc/init.d/apache2 restart
# Enabling mod_rewrite
$ sudo a2enmod rewrite
$ service apache2 restart
我在终端上运行它:
$ docker build -t docker-lamp .
$ docker build -t docker-lamp .
Sending build context to Docker daemon 2.56 kB
Step 1 : FROM linuxconfig/apache:latest
latest: Pulling from linuxconfig/apache
75a822cd7888: Pull complete
7265e4579453: Pull complete
7a28f7c3739d: Pull complete
Digest: sha256:dcbb38ea5028d09dd5aeb4b5cd343285d44edc616ec66cf7e5ba4dcee0a5bb8c
Status: Downloaded newer image for linuxconfig/apache:latest
---> 89a6a2f193ec
Step 2 : ENV DEBIAN_FRONTEND noninteractive
---> Running in 144fad888f01
---> 01681a524cef
Removing intermediate container 144fad888f01
Step 3 : RUN apt-get update
---> Running in eba267dccc10
Get:1 http://security.debian.org jessie/updates InRelease [63.1 kB]
Ign http://deb.debian.org jessie InRelease
Get:2 http://deb.debian.org jessie-updates InRelease [145 kB]
Hit http://deb.debian.org jessie Release.gpg
Get:3 http://deb.debian.org jessie-updates/main amd64 Packages [17.6 kB]
Hit http://deb.debian.org jessie Release
Get:4 http://security.debian.org jessie/updates/main amd64 Packages [430 kB]
Get:5 http://deb.debian.org jessie/main amd64 Packages [9064 kB]
Fetched 9719 kB in 2min 46s (58.4 kB/s)
Reading package lists...
---> 9fd9f0de570d
Removing intermediate container eba267dccc10
Step 4 : RUN apt-get -y install php7.0-mysql php7.0-curl php7.0-json php7.0-cgi php7.0 libapache2-mod-php7
---> Running in dcc079249142
Reading package lists...
Building dependency tree...
Reading state information...
E: Unable to locate package php7.0-mysql
E: Couldn't find any package by regex 'php7.0-mysql'
E: Unable to locate package php7.0-curl
E: Couldn't find any package by regex 'php7.0-curl'
E: Unable to locate package php7.0-json
E: Couldn't find any package by regex 'php7.0-json'
E: Unable to locate package php7.0-cgi
E: Couldn't find any package by regex 'php7.0-cgi'
E: Unable to locate package php7.0
E: Couldn't find any package by regex 'php7.0'
E: Unable to locate package libapache2-mod-php7
The command '/bin/sh -c apt-get -y install php7.0-mysql php7.0-curl php7.0-json php7.0-cgi php7.0 libapache2-mod-php7' returned a non-zero code: 100
但我得到了这个错误:
E: Unable to locate package php7.0-mysql
E: Couldn't find any package by regex 'php7.0-mysql'
E: Unable to locate package php7.0-curl
E: Couldn't find any package by regex 'php7.0-curl'
E: Unable to locate package php7.0-json
E: Couldn't find any package by regex 'php7.0-json'
E: Unable to locate package php7.0-cgi
E: Couldn't find any package by regex 'php7.0-cgi'
E: Unable to locate package php7.0
E: Couldn't find any package by regex 'php7.0'
E: Unable to locate package libapache2-mod-php7
为什么我会有这样的错误?我做错了什么
此外,在我的标准灯具安装中,我必须配置phpMyadmin:
Open terminal, and type:
$ sudo nano /etc/apache2/apache2.conf
Add the following line at the end:
include /etc/phpmyadmin/apache.conf
Save and Exit. Restart apache service:
$ sudo systemctl restart apache2
我在Docker怎么做
我的终端上的完整输出:
$ docker build -t docker-lamp .
$ docker build -t docker-lamp .
Sending build context to Docker daemon 2.56 kB
Step 1 : FROM linuxconfig/apache:latest
latest: Pulling from linuxconfig/apache
75a822cd7888: Pull complete
7265e4579453: Pull complete
7a28f7c3739d: Pull complete
Digest: sha256:dcbb38ea5028d09dd5aeb4b5cd343285d44edc616ec66cf7e5ba4dcee0a5bb8c
Status: Downloaded newer image for linuxconfig/apache:latest
---> 89a6a2f193ec
Step 2 : ENV DEBIAN_FRONTEND noninteractive
---> Running in 144fad888f01
---> 01681a524cef
Removing intermediate container 144fad888f01
Step 3 : RUN apt-get update
---> Running in eba267dccc10
Get:1 http://security.debian.org jessie/updates InRelease [63.1 kB]
Ign http://deb.debian.org jessie InRelease
Get:2 http://deb.debian.org jessie-updates InRelease [145 kB]
Hit http://deb.debian.org jessie Release.gpg
Get:3 http://deb.debian.org jessie-updates/main amd64 Packages [17.6 kB]
Hit http://deb.debian.org jessie Release
Get:4 http://security.debian.org jessie/updates/main amd64 Packages [430 kB]
Get:5 http://deb.debian.org jessie/main amd64 Packages [9064 kB]
Fetched 9719 kB in 2min 46s (58.4 kB/s)
Reading package lists...
---> 9fd9f0de570d
Removing intermediate container eba267dccc10
Step 4 : RUN apt-get -y install php7.0-mysql php7.0-curl php7.0-json php7.0-cgi php7.0 libapache2-mod-php7
---> Running in dcc079249142
Reading package lists...
Building dependency tree...
Reading state information...
E: Unable to locate package php7.0-mysql
E: Couldn't find any package by regex 'php7.0-mysql'
E: Unable to locate package php7.0-curl
E: Couldn't find any package by regex 'php7.0-curl'
E: Unable to locate package php7.0-json
E: Couldn't find any package by regex 'php7.0-json'
E: Unable to locate package php7.0-cgi
E: Couldn't find any package by regex 'php7.0-cgi'
E: Unable to locate package php7.0
E: Couldn't find any package by regex 'php7.0'
E: Unable to locate package libapache2-mod-php7
The command '/bin/sh -c apt-get -y install php7.0-mysql php7.0-curl php7.0-json php7.0-cgi php7.0 libapache2-mod-php7' returned a non-zero code: 100
有什么想法吗
顺便说一下,我在Ubuntu 16.04上