What is Python Twisted?  According to Wikipedia:

“Twisted is an event-driven network programming framework written in Python and licensed under the MIT License.

Twisted projects variously support TCPUDPSSL/TLSIP multicast, Unix domain sockets, a large number of protocols (including HTTPXMPPNNTPIMAPSSHIRCFTP, and others), and much more. Twisted is based on the event-driven programmingparadigm, which means that users of Twisted write short callbacks which are called by the framework.”

Docker Image download site:


Note:  I will be running this example as root user.  This is typically bad for security reasons but I am only doing this for demonstration purposes.  In real life, setup a sudo user instead.

1.) In the first step we pull the docker image down from the repository with the command below.

docker pull waxcage/python-twisted

2.) After the image downloads, we can execute the docker image ls command to verify we have the image.

3.) Next, we will need to run our image.  We do this with the docker run -it waxcage/python-twisted command.  The -it switches basically give us a shell to our running docker instance.

  • -i  switch is for interactive mode
  • -t  switch is for terminal emulation

Notice that the terminal host name has now changed to “root@edef75d3f36c:/#”.  This proves that we have a shell with the docker instance and no longer have a shell with our Linux host.

Note:  Once an image is running in docker, it is called a container.

4.) Press Ctrl – PQ to exit the container without terminating it.  We are now back at out host Linux shell prompt.

5.) To see our running docker containers, enter the command: docker container ls

6.) To access the shell of our running container, enter the command:

docker container exec -it edef75d3f36c bash

Notice above when we did a docker container ls that we needed to note and specify the CONTAINER ID and use it in the command below to attach to our container.  You know we are at the container’s shell as the bash prompt has changed to the container ID.