Redge Shepherd
TclTk Scripts

TclTk Scripts

Docker - I'm In

Photo by Robert Linder on Unsplash

Docker - I'm In

Running Docker Images - Python 3.11 in VS Code and Tcl in a Terminal

Redge Shepherd's photo
Redge Shepherd
·May 4, 2022·

3 min read

Subscribe to my newsletter and never miss my upcoming articles

Table of contents

Background

I know I was late to the party, but I now understand the value Docker brings to developing code.

I installed Docker several weeks ago after reading a number of articles that either referred to it or used it specifically. This article, "Python is About to Become 64% Faster - Python 3.10 vs Python 3.11 Benchmark," by Dario Radečić clearly demonstrates how easy it is to use Docker to create an image and deploy it using Visual Studio Code (VS Code).

The Docker extension in Visual Studio Code (VS Code) makes working with Docker an easy task and I'm hooked. While there is much learning to do, I'm looking forward to using Docker more so as part of my application development process.

Following the instructions in Dario's article, I managed to create a Python 3.11 image in Docker and begin a terminal session in VS Code as demonstrated in the following pictures.

Beginning the Installation

Python-Docker 2022-05-01 071943.png

Python Installation Complete

Python-Docker-Installation Complete 2022-05-01 071943.png

Ready to Launch an Interactive Python Session in the Terminal

Python-Docker-Run-VS-Code 2022-05-01 071943.png

Terminal Session Using Docker with VS Code

Python-VS-Code-Terminal Session 2022-05-01 124128.png

Learning is a Journey

This may be a trivial matter for seasoned programmers, but I never felt the need to use Docker and I tend to be somewhat reluctant to adopt new technologies unless I see an immediate need to. With so many tools at our fingertips, it is increasingly difficult to discern between the ones that will actually help and pass the test of time.

It's time to create a Tcl/Tk Docker image ...

Visit the efrecon site on GitHub, download and extract the contents of the zip file, then run the command docker-tcl-master>docker build -t efrecon/tcl . including the period at the end of the command!

Docker will begin building your image which may take some time depending on your internet connection. After the build is complete, enter docker run -it --rm efrecon/tcl in your terminal to run tcl as pictured below:

Tcl Shell Running in Docker 2022-05-03 221550.png

We can open another terminal window and enter docker ps to see the processes running in docker.

Tcl process running in Docker 2022-05-03 220934.png

Stop a Docker Container

Use the Docker Stop ***Container ID*** command to stop a Docker Container. We can stop the container from our example as pictured below:

Stop Docker Session 2022-05-03 223533.png

From the Documentation (docs.docker.com)

a container:

  • is a runnable instance of an image. You can create, start, stop, move, or delete a container using the DockerAPI or CLI.
  • can be run on local machines, virtual machines or deployed to the cloud.
  • is portable (can be run on any OS)
  • Containers are isolated from each other and run their own software, binaries, and configurations.

Related Articles and Resources

Did you find this article valuable?

Support Redge Shepherd by becoming a sponsor. Any amount is appreciated!

Learn more about Hashnode Sponsors
 
Share this