Table of Contents
dock
is a Docker Helper Script that simplifies the management of Docker containers and provides convenience functions
for working with Docker Compose, SSL certificates, and SSH access within containers.
Before using Dock, ensure you have the following prerequisites installed on your system:
Follow these steps to install and configure Dock on your system:
-
Clone the Dock repository to your local machine:
git clone https://github.com/puncoz-official/dock.git
-
Copy the
env.example
file and update it with your desired configuration:cp env.example .env # Edit the .env file with your configurations
-
[Optional] For convenience, add the
./dock
script to your system's PATH. On macOS or Linux, you can do this by adding the following line to your shell profile (e.g.,~/.bashrc
,~/.zshrc
):export PATH="$PATH:/path/to/dock"
On Windows, you can add the directory containing
dock
to your system's environment PATH. -
Apply SSL certificates by running the following command:
dock certs:apply
-
Start the Docker Compose application by running:
# to start all services dock up # to start specific services dock up <service1-name> <service2-name>
Dock provides several commands to manage your Docker environment.
Generate and manage SSL certificates for your domains.
-
Generate Certificates for Domains:
dock certs [-n cert_name] [-d domain_name_1] [-d domain_name_2] ...
Example:
dock certs -n my_app -d "my-app.localhost" -d "*.my-app.localhost"
-
Apply Generated Certificates:
dock certs:apply
Manage Docker Compose services.
-
Start the Application (Runs in the Background):
dock up
-
Stop the Application:
dock down
-
Supports All Docker-Compose Commands:
dock [commands] # eg: dock ps
Access shell sessions within Docker containers.
-
Start a Shell Session within the Application Container (as Root User):
dock ssh <service-name>
-
Start a Shell Session within the Application Container (as a User Supplied):
dock ssh user@<service-name>
Here are some common usage examples of Dock:
-
Generate SSL certificates for a domain:
dock certs -n my_app -d "my-app.localhost" -d "*.my-app.localhost"
-
Apply SSL certificates:
dock certs:apply
-
Start the Docker Compose application:
dock up
-
Stop the Docker Compose application:
dock down
-
Access a shell session within the application container as the root user:
dock ssh <service-name>
-
Access a shell session within the application container as a specific user:
dock ssh user@<service-name>
If you encounter an "Access denied for user 'root'@'localhost'" issue with MySQL 5.7, follow these steps before creating a database:
Run the following command (replace 'password'
with your desired password) before creating the database. If the
database is already created, drop the database and recreate it after running this command:
GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY 'password';
To generate SSL certificates for HTTPS, follow these steps:
-
Install mkcert:
# If it's the first install of mkcert, run mkcert -install
-
Generate a certificate for your domain and store it in the
certs
directory:mkcert -cert-file ./data/certs/local-cert.pem -key-file ./data/certs/local-key.pem "localhost" "subdomain.localhost"
This will create two files:
local-cert.pem
andlocal-key.pem
in thecerts
directory, which can be used for configuring HTTPS in your application.
Contributions to dock
are welcome! If you have any suggestions, bug reports, or feature requests, please create an
issue or submit a pull request on the GitHub repository.
This project is licensed under the MIT License - see the LICENSE file for details.