将标准LAMP安装转换为Docker?

我试图学习Docker,并将我已经使用的LAMP堆栈安装转换为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 # 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 

我的DockerFile(我遵循这个Docker 镜像 ):

 FROM linuxconfig/apache:latest ENV DEBIAN_FRONTEND noninteractive # Main package installation RUN apt-get update # Install PHP 7 RUN apt-get -y install php7.0-mysql php7.0-curl php7.0-json php7.0-cgi php7.0 libapache2-mod-php7 # Install PHP Curl RUN apt-get -y install php-curl # Install MySQLs RUN apt-get -y install supervisor mysql-server mysql-client # Configure MySQL RUN sed -i 's/bind-address/#bind-address/' /etc/mysql/my.cnf # Install phpmyadmin RUN apt-get -y install phpmyadmin # Include supervisor configuration ADD supervisor-lamp.conf /etc/supervisor/conf.d/ ADD supervisord.conf /etc/supervisor/ # Include PHP Info page ADD index.php /var/www/html/index.php # Create new MySQL admin user RUN service mysql start; mysql -u root -e "CREATE USER 'admin'@'%' IDENTIFIED BY 'pass';";mysql -u root -e "GRANT ALL PRIVILEGES ON *.* TO 'admin'@'%' WITH GRANT OPTION;"; # Allow ports EXPOSE 80 3306 # Start supervisor CMD ["supervisord"] 

我在terminal上运行它:

 $ docker build -t docker-lamp . 

但是我得到这个错误:

 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 

为什么我有这个错误? 我做错了什么?

另外,在我的标准LAMP安装中,我必须configurationphpMyadmin:

 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中做到这一点?

我的terminal上的完整输出:

 $ 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上。