testcontainers / testcontainers/testcontainers-python
Question: How to specify arguments when starting generic container
Personne n'a encore pris cette issue.
- Langage dominant
- Python
- Étoiles
- 2.3k
- Forks
- 386
- Merge moyen
- 4 h 40 min
- PR mergées (30 j)
- 1
Description
What are you trying to do?
How can I specify argument such as --privileged or --user when starting a container?
Where are you trying to do it?
I am trying to run a container with these options:
podman run -it --privileged --user 0 --rm -p 8181:80 --entrypoint /sbin/init -d registry.access.redhat.com/ubi8/ubi-init /sbin/init
I am using the DockerContainer example and I would like to add the above arguments to this:
from testcontainers.core.container import DockerContainer
from testcontainers.core.waiting_utils import wait_for_logs
with DockerContainer("hello-world") as container:
delay = wait_for_logs(container, "Hello Podman World")
Runtime environment
I am using OpenShift DevSpaces with podman and kubedock.
Linux workspacea403e1942d9d47a1-d8799b4cd-zd5hs 5.14.0-427.49.1.el9_4.x86_64 #1 SMP PREEMPT_DYNAMIC Fri Dec 6 16:42:22 EST 2024 x86_64 x86_64 x86_64 GNU/Linux
------
host:
arch: amd64
buildahVersion: 1.37.5
cgroupControllers:
- cpuset
- cpu
- io
- memory
- hugetlb
- pids
- rdma
- misc
cgroupManager: cgroupfs
cgroupVersion: v2
conmon:
package: conmon-2.1.12-1.el9.x86_64
path: /usr/bin/conmon
version: 'conmon version 2.1.12, commit: c0564282e9befb7804c3642230f8e94f1b2ba9f8'
cpuUtilization:
idlePercent: 91.9
systemPercent: 3.01
userPercent: 5.09
cpus: 32
databaseBackend: sqlite
distribution:
distribution: rhel
version: "9.5"
eventLogger: file
freeLocks: 2048
hostname: workspacea403e1942d9d47a1-d8799b4cd-zd5hs
idMappings:
gidmap:
- container_id: 0
host_id: 0
size: 1
- container_id: 1
host_id: 10000
size: 65536
uidmap:
- container_id: 0
host_id: 1000850000
size: 1
- container_id: 1
host_id: 10000
size: 65536
kernel: 5.14.0-427.49.1.el9_4.x86_64
linkmode: dynamic
logDriver: k8s-file
memFree: 12690300928
memTotal: 67095285760
networkBackend: netavark
networkBackendInfo:
backend: netavark
dns:
package: aardvark-dns-1.12.2-1.el9_5.x86_64
path: /usr/libexec/podman/aardvark-dns
version: aardvark-dns 1.12.2
package: netavark-1.12.2-1.el9.x86_64
path: /usr/libexec/podman/netavark
version: netavark 1.12.2
ociRuntime:
name: crun
package: crun-1.16.1-1.el9.x86_64
path: /usr/bin/crun
version: |-
crun version 1.16.1
commit: afa829ca0122bd5e1d67f1f38e6cc348027e3c32
rundir: /tmp/storage-run-1000850000/crun
spec: 1.0.0
+SYSTEMD +SELINUX +APPARMOR +CAP +SECCOMP +EBPF +CRIU +YAJL
os: linux
pasta:
executable: /usr/bin/pasta
package: passt-0^20240806.gee36266-2.el9.x86_64
version: |
pasta 0^20240806.gee36266-2.el9.x86_64
Copyright Red Hat
GNU General Public License, version 2 or later
<https://www.gnu.org/licenses/old-licenses/gpl-2.0.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
remoteSocket:
exists: false
path: /tmp/storage-run-1000850000/podman/podman.sock
rootlessNetworkCmd: pasta
security:
apparmorEnabled: false
capabilities: CAP_CHOWN,CAP_DAC_OVERRIDE,CAP_FOWNER,CAP_FSETID,CAP_KILL,CAP_NET_BIND_SERVICE,CAP_SETFCAP,CAP_SETGID,CAP_SETPCAP,CAP_SETUID,CAP_SYS_CHROOT
rootless: true
seccompEnabled: true
seccompProfilePath: /usr/share/containers/seccomp.json
selinuxEnabled: false
serviceIsRemote: false
slirp4netns:
executable: /usr/bin/slirp4netns
package: slirp4netns-1.3.1-1.el9.x86_64
version: |-
slirp4netns version 1.3.1
commit: e5e368c4f5db6ae75c2fce786e31eef9da6bf236
libslirp: 4.4.0
SLIRP_CONFIG_VERSION_MAX: 3
libseccomp: 2.5.2
swapFree: 0
swapTotal: 0
uptime: 120h 47m 38.00s (Approximately 5.00 days)
variant: ""
plugins:
authorization: null
log:
- k8s-file
- none
- passthrough
- journald
network:
- bridge
- macvlan
- ipvlan
volume:
- local
registries:
search:
- registry.access.redhat.com
- registry.redhat.io
- docker.io
store:
configFile: /home/user/.config/containers/storage.conf
containerStore:
number: 0
paused: 0
running: 0
stopped: 0
graphDriverName: vfs
graphOptions: {}
graphRoot: /home/user/.local/share/containers/storage
graphRootAllocated: 21402464256
graphRootUsed: 10847875072
graphStatus: {}
imageCopyTmpDir: /var/tmp
imageStore:
number: 0
runRoot: /tmp/storage-run-1000850000/containers
transientStore: false
volumePath: /home/user/.local/share/containers/storage/volumes
version:
APIVersion: 5.2.2
Built: 1731660571
BuiltTime: Fri Nov 15 08:49:31 2024
GitCommit: ""
GoVersion: go1.22.7 (Red Hat 1.22.7-2.el9_5)
Os: linux
OsArch: linux/amd64
Version: 5.2.2
------
python --version
Python 3.11.9
------
Guide de contribution
Ouvrir le guide de contribution
Par où commencer
- Lisez l'issue en entier, puis le guide de contribution du projet.
- Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
- Forkez le dépôt et travaillez sur une branche.
- Ouvrez une pull request qui référence le numéro de l'issue.
Piste de recherche
Commencez par l’exemple DockerContainer dans l’issue et localisez son point d’entrée dans le package testcontainers Python. Examinez la configuration et la documentation existantes du démarrage du conteneur afin de déterminer où doivent être placées les options d’exécution demandées ; le travail est terminé lorsque les options peuvent être spécifiées pour l’invocation basée sur Podman présentée.
Rédigé par le modèle d'indexation à partir du texte de l'issue.
Évaluation
- Stack technique
- docker, python
- Domaine
- testing-qa
- Type d'issue
- Fonctionnalité
- Difficulté
- 3/5
- Temps estimé
- 1-2 jours
- Activité
- À l'abandon
- Clarté
- À clarifier
- Accessibilité débutants
- 30/100