This project is intended to help you create and manage your Docker projects. It was tested on MacOS (Docker for Mac) but Linux/Windows users can also use this for their Docker projects (be aware installation instruction is for MacOS users but it should work in similar way for Windows/Linux users). It's intended only for local usage (no security aspects included). This project is intended to help you create and manage your Docker projects. It was tested on MacOS (Docker for Mac) but Linux/Windows users can also use this for their Docker projects (be aware installation instruction is for MacOS users but it should work in similar way for Windows/Linux users). It's intended only for local usage (no security aspects included).
The following components are available at the moment:
- PHP 5.6
- PHP 7.0
- PHP 7.1
- PHP 7.2
- PHP 7.3
- PHP 7.4
- PHP 8.0
- PHP 8.1
- MySQL 5.6
- MySQL 5.7
- MySQL 8.0
- Nginx
-
Clone this repository
-
Open terminal
-
Into directory of your selection you should create
Docker
directory (you can name it whatever you want). Into directory put content ofdocker
directory from this repository, copy also.bashrc
file to your user directory and make sure it has been loaded. -
Open
.bashrc
file now and set:DOCKER_DIR='/Users/marcin/Docker/'; DEFINITIONS_DIR='/Users/marcin/Docker/definitions/';
correctly. Probably you should change here only
marcin
into your current MacOS user if you createdDocker
directory in your home directory. Otherwise use custom path. -
Now open
projects/proxy/docker-composer.yml
file inside your DOCKER_DIR directory and update line:/Users/marcin/Docker/local_share/certificates:/etc/nginx/certs:ro
with valid path.
-
In terminal run now:
docc
you will see aliases and extra commands for managing Docker projects (If it doesn't work double check if
.bashrc
is loaded). -
Into
local_directory
of your docker directory you should put public SSH key (in OpenSSH format) intossh
subdirectory and you should generate Github access token and put it intogithub-oauth
file oftokens
directory
In terminal run dcc
to create project, you will see required parameters for this command.
Example creation of project:
dcc test.local test 8080 18080 30060 220 10010
Now if everything goes fine, you can run the project running in terminal:
dcu test.local
By default
Now you can access your site in browser using your Docker IP (usually 192.168.0.196) and port you gave for dcc
command - in this case it would be 192.168.0.196:8080
If you want to run your site using domain without port, add
192.168.99.100 test.local
into your MacOS hosts
file
and run also
dcu proxy
Now you should be able to access your site using both http://test.local
and https://test.local
.
When you create other projects you should make sure you are using other ports than in different projects, so you should write down those ports each time you add new project to make sure there won't be any port collisions between projects.
To stop, build etc. project please look at docc
command list. You can also investigate .bashrc
content to know what exactly those commands do.
You can SSH into PHP container using private key, www-data
as user, docker IP and SSH port you gave using dcc
command. Alternatively you can also log in using 123
password. You can also log in as root user (same password) but it's recommended to log in as www-data
user to avoid permissions problems.
You can connect to database server using root
as user, pass
as password (by default) docker IP and database port you gave using dcc
command.
To connect database from PHP application you can use db
as host, 3306
as port, root
as username and pass
as password (by default).
The following predefined templates are available at the moment:
- PHP 5.6 with MySQL 5.6 and Nginx
- PHP 7.0 with MySQL 5.7 and Nginx
- PHP 7.1 with MySQL 5.7 and Nginx
- PHP 7.2 with MySQL 5.7 and Nginx
- PHP 7.2 with MySQL 8.0 and Nginx
- PHP 7.3 with MySQL 8.0 and Nginx
- PHP 7.4 with MySQL 8.0 and Nginx
- PHP 8.0 with MySQL 5.7 and Nginx
- PHP 8.0 with MySQL 8.0 and Nginx
By default when creating new project using dcc
command will be selected template defined in .bashrc
for DEFAULT_TEMPLATE
variable (it's set to PHP 8.0 with MySQL 8 and Nginx by default).
Obviously depending on your needs you might want to create custom templates (in templates
) or even brand new components (in definitions
directory) that will fit better your desired environment.
This packages uses by default PHP with Nginx images - you can find their source at Docker images
This package is licenced under the MIT license