Skip to content

Same Docker attach image command errs when running both roles on same device #11

@rrybarczyk

Description

@rrybarczyk

Background

When testing #10 which involved locally running both participants on the same computer, some issues arose with the command listed on the presentation for participants to connect to the Docker image:

% docker run --expose 34264 -p 34264:34264 --expose 34254 -p 34254:34254 --expose 34255 -p 34255:34255 -it --rm --name participant_container rrybarczyk/sv2-workshop:latest

Problem

If both participant roles (pool and miner) are ran on the same computer and both try to connect with this same command, the following errors occurs on the second participant that attaches:

% docker run --expose 34264 -p 34264:34264 --expose 34254 -p 34254:34254 --expose 34255 -p 34255:34255 -it --rm --name participant_container rrybarczyk/sv2-workshop:latest
docker: Error response from daemon: Conflict. The container name "/participant_container" is already in use by container "bd75524fda4a5e2925864c01e4f95c86a650010b9f3ef2fb503a0af4a92c7cda". You have to remove (or rename) that container to be able to reuse that name.
See 'docker run --help'.

Solution

To address this error, the participant_container name can be updated so each role runs:

Pool role attaches to image with:

% docker run --expose 34264 -p 34264:34264 --expose 34254 -p 34254:34254 --expose 34255 -p 34255:34255 -it --rm --name participant_container_pool rrybarczyk/sv2-workshop:latest

Miner role attaches to image with:

% docker run --expose 34264 -p 34264:34264 --expose 34254 -p 34254:34254 --expose 34255 -p 34255:34255 -it --rm --name participant_container_pool_miner rrybarczyk/sv2-workshop:latest

However, a new error emerges after fixing the container name when the second participant attaches after the first:

% docker run --expose 34264 -p 34264:34264 --expose 34254 -p 34254:34254 --expose 34255 -p 34255:34255 -it --rm --name participant_container_miner rrybarczyk/sv2-workshop:latest
docker: Error response from daemon: driver failed programming external connectivity on endpoint participant_container_miner (ad88941860bcdbb0ccc5b0705bf9a46ed0e556d1609804b0d57b953057ecda40): Bind for 0.0.0.0:34264 failed: port is already allocated.

To fix this error, we need to adjust which ports are exposed for each participant. The follow commands should be used:

Pool role should attach to the image with:

% docker run --expose 34264 -p 34264:34264 --expose 34254 -p 34254:34254 -it --rm --name participant_container_pool rrybarczyk/sv2-workshop:latest

Miner role should attach to the image with:

% docker run --expose 34255 -p 34255:34255 -it --rm --name participant_container_miner rrybarczyk/sv2-workshop:latest

Implementation

  • Update the command in the presentation for each role to connect to
  • Note that this command is listed at the beginning of the presentation before the participants split up into pool and miner roles. Therefore, we will need to move this command (along with the initial bitcoin commands that all participants run) to the beginning of the "Hands on" section

Metadata

Metadata

Assignees

Labels

bugSomething isn't workingdockerdocumentationImprovements or additions to documentation

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions