ruby / ruby/open3

Cannot execute docker exec command on WSL2 using open3

Open
#23 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Ruby
Stars
121
Forks
14
Avg merge
17m
Merged PRs (30d)
2

Description

Im having issues running a docker exec command on WSL2 using open3. To reproduce I wrote this simple script:

require 'open3'

command = "docker exec -i <CONTAINER_NAME> ls /"
puts "Running #{command}"

stdout, stderr, status = Open3.capture3(command)

puts "STDOUT: #{stdout}"
puts "STDERR: #{stderr}"
puts "STATUS: #{status.exitstatus}"

Running in WSL2 this results in output:

STDOUT:
STDERR:
STATUS: 0

If I run this script in git bash instead I get output:

Running docker exec -i service-build-instance ls /
STDOUT: bin
boot
build
dev
etc
home
lib
lib64
media
mnt
opt
proc
root
run
sbin
srv
sys
tmp
usr
var
STDERR:
STATUS: 0

Anyone who may know what is going on here?

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the reproduction script and its Open3.capture3 call, then compare the command's behavior in WSL2 and Git Bash. Determine whether the empty stdout with exit status 0 comes from Open3, Docker, or the environment; done means identifying the cause and a supported next step or documenting that the issue is external to Open3.

Written by the indexing model from the issue text.

Assessment

Tech stack
docker, ruby
Domain
cli, operating-systems, tooling
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.