-
Notifications
You must be signed in to change notification settings - Fork 322
Open
Description
Describe the bug
Using the default config for the SFTP testcontainer, the Script raises a TimeoutError. Seems to only happen with an RSA keypair user, which is included by default.
To Reproduce
Provide a self-contained code snippet that illustrates the bug or unexpected behavior. Ideally, send a Pull Request to illustrate with a test that illustrates the problem.
from testcontainers.sftp import SFTPContainer
with SFTPContainer() as sftp_container:
print("Hello World")
Results in:
Pulling image testcontainers/ryuk:0.8.1
Container started: cffcdb6f31c4
Waiting for container <Container: cffcdb6f31c4> with image testcontainers/ryuk:0.8.1 to be ready ...
Pulling image atmoz/sftp:alpine
Container started: 170fb1ee983a
Traceback (most recent call last):
File "/.../minimum_example.py", line 3, in <module>
with SFTPContainer() as sftp_container:
File "/.../.venv/lib/python3.12/site-packages/testcontainers/core/container.py", line 134, in __enter__
return self.start()
^^^^^^^^^^^^
File "/.../.venv/lib/python3.12/site-packages/testcontainers/sftp/__init__.py", line 269, in start
wait_for_logs(self, f".*Server listening on 0.0.0.0 port {self.port}.*")
File "/.../.venv/lib/python3.12/site-packages/testcontainers/core/waiting_utils.py", line 125, in wait_for_logs
raise TimeoutError(f"Container did not emit logs satisfying predicate in {timeout:.3f} " "seconds")
TimeoutError: Container did not emit logs satisfying predicate in 120.000 seconds
Using only a user with a Password Authentication (no RSA key pairs) seems to work fine:
from testcontainers.sftp import SFTPContainer, SFTPUser
sftp_user = SFTPUser(name="user", password="Secret")
with SFTPContainer(users=[sftp_user]) as sftp_container:
print("Hello World")
Pulling image testcontainers/ryuk:0.8.1
Container started: 22ffa2ac108b
Waiting for container <Container: 22ffa2ac108b> with image testcontainers/ryuk:0.8.1 to be ready ...
Pulling image atmoz/sftp:alpine
Container started: a51c685e2d50
Hello World
Runtime environment
Provide a summary of your runtime environment. Which operating system, python version, and docker version are you using? What is the version of testcontainers-python
you are using? You can run the following commands to get the relevant information.
# Get the operating system information (on a unix os).
$ uname -a
Linux aoudad 6.8.0-60-generic #63~22.04.1-Ubuntu SMP PREEMPT_DYNAMIC Tue Apr 22 19:00:15 UTC 2 x86_64 x86_64 x86_64 GNU/Linux
# Get the python version.
$ python --version
Python 3.12.2
# Get the docker version and other docker information.
$ docker info
Client: Docker Engine - Community
Version: 28.1.1
Context: default
Debug Mode: false
Plugins:
buildx: Docker Buildx (Docker Inc.)
Version: v0.23.0
Path: /usr/libexec/docker/cli-plugins/docker-buildx
compose: Docker Compose (Docker Inc.)
Version: v2.35.1
Path: /usr/libexec/docker/cli-plugins/docker-compose
Server:
Containers: 4
Running: 0
Paused: 0
Stopped: 4
Images: 10
Server Version: 28.1.1
Storage Driver: overlay2
Backing Filesystem: extfs
Supports d_type: true
Using metacopy: false
Native Overlay Diff: true
userxattr: false
Logging Driver: json-file
Cgroup Driver: systemd
Cgroup Version: 2
Plugins:
Volume: local
Network: bridge host ipvlan macvlan null overlay
Log: awslogs fluentd gcplogs gelf journald json-file local splunk syslog
Swarm: inactive
Runtimes: runc io.containerd.runc.v2
Default Runtime: runc
Init Binary: docker-init
containerd version: 05044ec0a9a75232cad458027ca83437aae3f4da
runc version:
init version: de40ad0
Security Options:
apparmor
seccomp
Profile: builtin
cgroupns
Kernel Version: 6.8.0-60-generic
Operating System: Ubuntu Core 22
OSType: linux
Architecture: x86_64
CPUs: 16
Total Memory: 30.18GiB
Name: aoudad
ID: f82c9622-c54f-491c-b224-132a4c383cd9
Docker Root Dir: /var/snap/docker/common/var-lib-docker
Debug Mode: false
Experimental: false
Insecure Registries:
::1/128
127.0.0.0/8
Live Restore Enabled: false
# Get all python packages.
$ pip freeze
asttokens==3.0.0
certifi==2025.4.26
cffi==1.17.1
charset-normalizer==3.4.2
comm==0.2.2
cryptography==45.0.3
debugpy==1.8.14
decorator==5.2.1
docker==7.1.0
executing==2.2.0
idna==3.10
ipykernel==6.29.5
ipython==9.3.0
ipython_pygments_lexers==1.1.1
jedi==0.19.2
jupyter_client==8.6.3
jupyter_core==5.8.1
matplotlib-inline==0.1.7
nest-asyncio==1.6.0
packaging==25.0
parso==0.8.4
pexpect==4.9.0
platformdirs==4.3.8
prompt_toolkit==3.0.51
psutil==7.0.0
ptyprocess==0.7.0
pure_eval==0.2.3
pycparser==2.22
Pygments==2.19.1
python-dateutil==2.9.0.post0
python-dotenv==1.1.0
pyzmq==26.4.0
requests==2.32.3
six==1.17.0
stack-data==0.6.3
testcontainers==4.10.0
tornado==6.5.1
traitlets==5.14.3
typing_extensions==4.14.0
urllib3==2.4.0
wcwidth==0.2.13
wrapt==1.17.2
alastairtree
Metadata
Metadata
Assignees
Labels
No labels