Docker Compose Port Conflict & Networking

๐Ÿ’ก Docker Compose Port Conflict & Networking โ€” Executive Summary

Technical architectural analysis, practical configuration manifests, and deployment instructions for Docker Compose Port Conflict & Networking.

Overview

If the following error occurs when running after installation

txt
Traceback (most recent call last):
  File "/usr/bin/docker-compose", line 6, in <module>
    from pkg_resources import load_entry_point
  File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 3088, in <module>
    @_call_aside
  File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 3072, in _call_aside
    f(*args, **kwargs)
  File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 3101, in _initialize_master_working_set
    working_set = WorkingSet._build_master()
  File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 574, in _build_master
    ws.require(__requires__)
  File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 892, in require
    needed = self.resolve(parse_requirements(requirements))
  File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 778, in resolve
    raise DistributionNotFound(req, requirers)
pkg_resources.DistributionNotFound: The 'docker-compose==1.17.1' distribution was not found and is required by the application
Solution
  • Use sudo docker-compose up -d.
  • Add permission to docker.
Add permission to docker
txt
sudo groupadd docker
sudo groupadd dockersudo
sudo usermod -aG docker $USER
newgrp dockersudo chown "$USER":"$USER" /home/"$USER"/.docker -R
sudo chmod g+rwx "$HOME/.docker" -Rg
Reference Document


The above method fails
Install manually
  1. To download and install the Compose CLI plugin, run:
txt
$ DOCKER_CONFIG=${DOCKER_CONFIG:-$HOME/.docker}
   $ mkdir -p $DOCKER_CONFIG/cli-plugins
   $ curl -SL https://github.com/docker/compose/releases/download/v2.14.0/docker-compose-linux-x86_64 -o $DOCKER_CONFIG/cli-plugins/docker-compose

This command downloads the latest release of Docker Compose (from the Compose release repository) and installs Compose for the active user under the $HOME directory.

To install:

  • Docker Compose ~/.docker/cli-plugins for all users on the system is /usr/local/lib/docker/cli-plugins.
  • v2.14.0For other versions of Compose, replace with the version of Compose you want to use.
  • For other architectures, replace with the desiredx86_64architecture.
    2. Apply execute permissions to the binary.
txt
$ chmod +x $DOCKER_CONFIG/cli-plugins/docker-compose

Or, if you choose to install Compose for all users:

txt
$ sudo chmod +x /usr/local/lib/docker/cli-plugins/docker-compose
  1. Test your installation.
txt
$ docker compose version
Reference Document

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *