Fading Coder

One Final Commit for the Last Sprint

Home > Tech > Content

Configuring Docker 17.09.0-ce to Start with a Custom Network Address

Tech 2

Prerequisites

A virtual machine running CentOS 7 is required for this setup.

Installing Docker 17.09.0-ce

  1. Remove Existing Docker Components

    • Uninstall any previously installed Docker packages:
      yum remove docker\*
      
    • Remove the container-selinux package to avoid conflicts:
      yum remove container-selinux-1.12.5-14.el7.centos.x86_64
      
  2. Set Up Docker Repository

    • Install yum-utils for repository management:
      sudo yum install -y yum-utils
      
    • Add the official Docker CE repository:
      sudo yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo
      
    • Update the package cache:
      sudo yum makecache fast
      
  3. Install Docker CE

    • List availible Docker CE versions:
      yum list docker-ce.x86_64 --showduplicates | sort -r
      
    • Enstall Docker CE version 17.09.0:
      sudo yum -y install docker-ce-17.09.0.ce
      
  4. Start Docker and Verify Installation

    • Start the Docker service:
      systemctl start docker
      
    • Enable Docker to start on boot:
      systemctl enable docker
      
    • Check the Docker version and info:
      docker info
      

Configuring Docker Startup Parameters

Examine the Docker service file to understand its configuration:

cat /lib/systemd/system/docker.service

The key paramter for customization is ExecStart in the [Service] section. This defines the command executed when starting Docker.

To modify the network address and other settings, update the ExecStart line. Below is an example configuration with custom parameters:

ExecStart=/usr/bin/dockerd --bip=172.18.0.1/16 -H tcp://0.0.0.0:5257 -H unix:///var/run/docker.sock --pidfile=/var/run/docker.pid

Parameter Explanation:

  • --bip=172.18.0.1/16: Sets the bridge IP address for container networking.
  • -H tcp://0.0.0.0:5257: Configures Docker to listen on TCP port 5257 for remote connections.
  • -H unix:///var/run/docker.sock: Specifies the Unix socket for local Docker communication.
  • --pidfile=/var/run/docker.pid: Defines the location for the Docker daemon's PID file.

For a full list of available options, run:

dockerd --help

Applying Configuration Changes

  1. Stop the Docker service:
    systemctl stop docker
    
  2. Reload the systemd configuration to apply changes:
    systemctl daemon-reload
    
  3. Start Docker with the new settings:
    systemctl start docker
    

Related Articles

Understanding Strong and Weak References in Java

Strong References Strong reference are the most prevalent type of object referencing in Java. When an object has a strong reference pointing to it, the garbage collector will not reclaim its memory. F...

Comprehensive Guide to SSTI Explained with Payload Bypass Techniques

Introduction Server-Side Template Injection (SSTI) is a vulnerability in web applications where user input is improper handled within the template engine and executed on the server. This exploit can r...

Implement Image Upload Functionality for Django Integrated TinyMCE Editor

Django’s Admin panel is highly user-friendly, and pairing it with TinyMCE, an effective rich text editor, simplifies content management significantly. Combining the two is particular useful for bloggi...

Leave a Comment

Anonymous

◎Feel free to join the discussion and share your thoughts.