Custom Server Environment

Hi, I am a newbie with Docker. I have it installed in Ubuntu 16.0.4 LTS.

How do i create an instance with the following server details?

Server OS: Debian GNU/Linux 8.3 (jessie)
Apache/2.4.10 (Debian)
PHP 5.6.19

[PHP Modules]
bcmath
bz2
calendar
Core
ctype
curl
date
dba
dom
ereg
exif
fileinfo
filter
ftp
gd
gettext
hash
iconv
json
libxml
mbstring
mhash
mysql
mysqli
openssl
pcntl
pcre
PDO
pdo_mysql
Phar
posix
readline
Reflection
session
shmop
SimpleXML
soap
sockets
SPL
standard
sysvmsg
sysvsem
sysvshm
tokenizer
wddx
xml
xmlreader
xmlwriter
Zend OPcache
zip
zlib

[Zend Modules]
Zend OPcache

mySQL 5.5.47-0+deb8u1

Thanks!

Hey @eramesvictor in order to do what you want to do you can use the php image from docker. I have done it like this before:

In the example below I am using php 5.6.32 with apache

In order to install the other extensions read this:

https://hub.docker.com/_/php/

There is a section called How to install more PHP extensions that’s how you install more php libraries.

Dockerfile

FROM php:5.6.32-apache-jessie

# Install the necessary packages for Ubuntu
RUN apt-get update && apt-get install -y \
  build-essential \

# Install MySQLi extension, this is where you can install the whole list of packages that you want
RUN docker-php-ext-install mysqli pdo pdo_mysql

EXPOSE 80 443

To use mysql, I recommend using a docker-compose.yml file and then link the mysql container to your php container. Here is an example of a docker-compose.yml file:

docker-compose.yml

version: '2'
services:
  app:
    build: .
    ports:
      - "80:80"
      - "21:21"
    links:
      - db
    stdin_open: true
    tty: true
  db:
    image: mariadb
    restart: always
    environment:
      MYSQL_ROOT_PASSWORD: [yourrootpassword]
      MYSQL_DATABASE: [app_db_name]
      MYSQL_USER: [app_db_user]
      MYSQL_PASSWORD: [your_db_password]

Then running docker-compose up will start the containers with the things you want. Let me know if you have any questions. I may have missed some stuff.