Docker Community Forums

Share and learn in the Docker community.

Possible to start container with python script running in tmux session?

Hi all. Is it possible to start a container and start a python script within a tmux session?

Consider the following:

version: '3'
services:
    container1:
        image: custompythonimage
        container_name: container_1
        networks:
            mynetwork:
                ipv4_address: 172.23.0.103
        entrypoint: 'tmux'
        command: 'new-session -d -s tmuxpy python3 testfile.py'

    conatiner2:
        image: custompythonimage
        container_name: container_2
        networks:
            mynetwork:
                ipv4_address: 172.23.0.70
        entrypoint: 'python3'
        command: 'testfile.py'


networks:
    mynetwork:
        external:
            name: mynetwork

I am able to get container2 up and running, but it seems as if container1 is not. Any solution to this?