Giter VIP home page Giter VIP logo

dock's Introduction

dock: Docker Helper Script

Table of Contents

Introduction

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.

Prerequisites

Before using Dock, ensure you have the following prerequisites installed on your system:

Installation

Follow these steps to install and configure Dock on your system:

  1. Clone the Dock repository to your local machine:

    git clone https://github.com/puncoz-official/dock.git
  2. Copy the env.example file and update it with your desired configuration:

    cp env.example .env
    # Edit the .env file with your configurations
  3. [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.

  4. Apply SSL certificates by running the following command:

    dock certs:apply
  5. Start the Docker Compose application by running:

    # to start all services
    dock up
    
    # to start specific services 
    dock up <service1-name> <service2-name>

Usage

Dock provides several commands to manage your Docker environment.

Certificate Commands

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

docker-compose Commands

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

SSH Commands

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>

Examples

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>

Tips

MySQL Grants

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';

SSL Certificates for HTTPS

To generate SSL certificates for HTTPS, follow these steps:

  1. Install mkcert:

    # If it's the first install of mkcert, run
    mkcert -install
  2. 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 and local-key.pem in the certs directory, which can be used for configuring HTTPS in your application.

Contributing

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.

License

This project is licensed under the MIT License - see the LICENSE file for details.

dock's People

Contributors

puncoz avatar

Stargazers

Bijaya Prasad Kuikel avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.