Seamless Host-Side Control of Docker

Published: May 3, 2025 by Kwantae Kim

Top


Open Source Chip Design

Getting Started

Install Open Source Tools

Try It Out

Verified with MacOS






There is an even easier way to control a Docker container. We can access the Docker terminal directly from the host terminal, just like using SSH.

This post assumes that you have finished the entire steps introduced in this post.






Container ID

First, find the Container ID of IIC-OSIC-TOOLS in Docker Desktop (see the Container ID column in the above screenshot).






Shell Script

Create a file named run_doc.sh under a directory that you chose for your Design Path of IIC-OSIC-TOOLS, like the below screenshot. Paste your Container ID into the script.

#!/bin/bash
container_id={your container ID}  # there must not be any spaces!
# Start the container if it's not running
if ! docker ps --format '' | grep -q "^$container_id$"; then
    echo "[INFO] Starting container $container_id..."
    docker start "$container_id" > /dev/null
fi
# Run interactive bash shell
docker exec -it "$container_id" bash

Next, open the terminal of VS Code by Ctrl + ` and run the following command to make the run_doc.sh executable:

chmod +x run_doc.sh

Now, you can run this shell by running:

./run_doc.sh

Note that your X11 Forwarding must be enabled to run this. X11 Forwarding can be set by (check this post):

  • In Windows, open MobaXterm and leave it opened. Check whether X Server icon is active on your upperright corner.
  • In MacOS, open XQuartz, run xhost + 127.0.0.1 on your XQuartz terminal, and leave XQuartz opened.

Now we can run open-source tools natively from our host VS Code terminal!






iverilog

klayout