Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
2 tasks
rrybarczyk opened this issue Sep 17, 2024 · 0 comments
Open
2 tasks
Assignees
Labels
bug Something isn't working docker documentation Improvements or additions to documentation

Comments

@rrybarczyk
Copy link
Collaborator

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
@rrybarczyk rrybarczyk added bug Something isn't working documentation Improvements or additions to documentation docker labels Sep 17, 2024
@rrybarczyk rrybarczyk self-assigned this Sep 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working docker documentation Improvements or additions to documentation
Projects
None yet
Development

No branches or pull requests

1 participant