README.md 2.46 KB
Newer Older
Ernesto Rodriguez Ortiz's avatar
Ernesto Rodriguez Ortiz committed
1
2
3
4
5
6
7
8
9
docker-drupal
=============

This repo contains a recipe for making a [Docker](http://docker.io) container for Drupal, using Linux, Apache and MySQL. 
To build, make sure you have Docker [installed](http://www.docker.io/gettingstarted/).

This will try to go in line with [Drupal automated-testing](https://drupal.org/automated-testing).

## Install docker:
Ernesto Rodriguez Ortiz's avatar
Ernesto Rodriguez Ortiz committed
10
First, check that your APT system can deal with https URLs: the file /usr/lib/apt/methods/https should exist. If it doesn't, you need to install the package apt-transport-https.
Ernesto Rodriguez Ortiz's avatar
Ernesto Rodriguez Ortiz committed
11
```
Ernesto Rodriguez Ortiz's avatar
Ernesto Rodriguez Ortiz committed
12
13
14
15
[ -e /usr/lib/apt/methods/https ] || {
  apt-get update
  apt-get install apt-transport-https
}
Ernesto Rodriguez Ortiz's avatar
Ernesto Rodriguez Ortiz committed
16
17
```

Ernesto Rodriguez Ortiz's avatar
Ernesto Rodriguez Ortiz committed
18
Then, add the Docker repository key to your local keychain.
Ernesto Rodriguez Ortiz's avatar
Ernesto Rodriguez Ortiz committed
19
```
Ernesto Rodriguez Ortiz's avatar
Ernesto Rodriguez Ortiz committed
20
sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 36A1D7869245C8950F966E92D8576A8BA88D21E9
Ernesto Rodriguez Ortiz's avatar
Ernesto Rodriguez Ortiz committed
21
```
Ernesto Rodriguez Ortiz's avatar
Ernesto Rodriguez Ortiz committed
22
Add the Docker repository to your apt sources list, update and install the lxc-docker package.
Ernesto Rodriguez Ortiz's avatar
Ernesto Rodriguez Ortiz committed
23
```
Ernesto Rodriguez Ortiz's avatar
Ernesto Rodriguez Ortiz committed
24
25
26
sudo sh -c "echo deb https://get.docker.com/ubuntu docker main > /etc/apt/sources.list.d/docker.list"
sudo apt-get update
sudo apt-get install lxc-docker
Ernesto Rodriguez Ortiz's avatar
Ernesto Rodriguez Ortiz committed
27
28
```

Ernesto Rodriguez Ortiz's avatar
Ernesto Rodriguez Ortiz committed
29
Add your user to the docker group to be able to execute docker command wihtout sudo
Ernesto Rodriguez Ortiz's avatar
Ernesto Rodriguez Ortiz committed
30
31

```
Ernesto Rodriguez Ortiz's avatar
Ernesto Rodriguez Ortiz committed
32
adduser <user> docker
Ernesto Rodriguez Ortiz's avatar
Ernesto Rodriguez Ortiz committed
33
34
```

Ernesto Rodriguez Ortiz's avatar
Ernesto Rodriguez Ortiz committed
35
## Clone this repo somewhere, 
Ernesto Rodriguez Ortiz's avatar
Ernesto Rodriguez Ortiz committed
36
```
Ernesto Rodriguez Ortiz's avatar
Ernesto Rodriguez Ortiz committed
37
38
git clone https://gitlab.savoirfairelinux.com/erortiz/docker-lampd.git
cd docker-lampd
Ernesto Rodriguez Ortiz's avatar
Ernesto Rodriguez Ortiz committed
39
```
Ernesto Rodriguez Ortiz's avatar
Ernesto Rodriguez Ortiz committed
40
and then build it:
Ernesto Rodriguez Ortiz's avatar
Ernesto Rodriguez Ortiz committed
41
```
Ernesto Rodriguez Ortiz's avatar
Ernesto Rodriguez Ortiz committed
42
sudo docker build -t sflinux/baseimage .
Ernesto Rodriguez Ortiz's avatar
Ernesto Rodriguez Ortiz committed
43
44
```

Ernesto Rodriguez Ortiz's avatar
Ernesto Rodriguez Ortiz committed
45
this can take a while but should eventually return a command prompt. It's done when it says "Successfully built {hash}"
Ernesto Rodriguez Ortiz's avatar
Ernesto Rodriguez Ortiz committed
46

Ernesto Rodriguez Ortiz's avatar
Ernesto Rodriguez Ortiz committed
47
48
That's it!
Now you have your base image that can be used in all your Drupal projects instead of use ubuntu:lastes or ubuntu:14.04
Ernesto Rodriguez Ortiz's avatar
Ernesto Rodriguez Ortiz committed
49

Ernesto Rodriguez Ortiz's avatar
Ernesto Rodriguez Ortiz committed
50
You can verifid this runing
Ernesto Rodriguez Ortiz's avatar
Ernesto Rodriguez Ortiz committed
51
52

```
Ernesto Rodriguez Ortiz's avatar
Ernesto Rodriguez Ortiz committed
53
54
55
# sudo docker images
REPOSITORY              TAG                 IMAGE ID            CREATED             VIRTUAL SIZE
sflinux/baseimage       latest              a57eacb74c44        4 days ago          723.7 MB
Ernesto Rodriguez Ortiz's avatar
Ernesto Rodriguez Ortiz committed
56
57
```

Ernesto Rodriguez Ortiz's avatar
Ernesto Rodriguez Ortiz committed
58
### More information about this project
Ernesto Rodriguez Ortiz's avatar
Ernesto Rodriguez Ortiz committed
59

Ernesto Rodriguez Ortiz's avatar
Ernesto Rodriguez Ortiz committed
60
This project use phusion/baseimage like base image to build and image with all the software neede to install Drupal projects and make tests
Ernesto Rodriguez Ortiz's avatar
Ernesto Rodriguez Ortiz committed
61

Ernesto Rodriguez Ortiz's avatar
Ernesto Rodriguez Ortiz committed
62
To read about why use phusion/baseimage and not ubuntu:14.04 look at [Phusion Baseimage](https://registry.hub.docker.com/u/phusion/baseimage/).
Ernesto Rodriguez Ortiz's avatar
Ernesto Rodriguez Ortiz committed
63

Ernesto Rodriguez Ortiz's avatar
Ernesto Rodriguez Ortiz committed
64
You generally not will need to run this image, it will be used generally to build other images
Ernesto Rodriguez Ortiz's avatar
Ernesto Rodriguez Ortiz committed
65
66
67
68
69
70
71
72


## Contributing
Feel free to fork and contribute to this code. :)


## Authors

Ernesto Rodriguez Ortiz's avatar
Ernesto Rodriguez Ortiz committed
73
Created and maintained by [Ernesto Rodriguez Ortiz][author] (ernesto.rodriguezortiz@savoirfairelinux.com>)
Ernesto Rodriguez Ortiz's avatar
Ernesto Rodriguez Ortiz committed
74
75

## License
Ernesto Rodriguez Ortiz's avatar
Ernesto Rodriguez Ortiz committed
76
GPL v2
Ernesto Rodriguez Ortiz's avatar
Ernesto Rodriguez Ortiz committed
77