Docker image and container setup

We have provided a Docker image that has all the tools we will be using pre-installed. If you are unfamilar with Docker/containers, there are many online tutorials available (e.g. here). Essentially Docker provides a lightweight “virtual” environment, permitting you to run different architectures/operating systems and libraries/platform environments on a machine. You will need to install Docker on your system.

Standard image setup

The standard Dockerfile we will use is the following. Please feel free to customize as you see fit!

FROM rajitmanohar/act_sky130:latest

USER root
RUN apt-get update
RUN apt-get -y install tightvncserver ssh vim emacs blackbox gnuplot xterm
RUN echo root:rootpass | chpasswd && echo user:userpass | chpasswd

USER root

CMD service ssh start ; while true ; do sleep 3600; done;

This configuration does the following:

  • It starts with the pre-built Docker image rajitmanohar/act_sky130:latest. Note that the base operating system is Linux (Ubuntu). It is a multi-platform build with binaries for both arm64 and amd64 architectures.
  • It extends it by installing a number of packages (text editors, a window manager, VNC server, etc.)
  • It sets the password for the user account user to userpass, and the root password to rootpass. You can use these later to login and install other packages if needed.
  • It starts the ssh service so you can use ssh to connect to your docker container. It then waits in an infinite loop so that the container keeps running so you can connect to it via ssh.

Feel free to customize this to install any software/tools/etc. you might want.

To build an image using the Dockerfile above (saved as Dockerfile in your working directory), run:

$ docker build -t async - < Dockerfile

This will use the Dockerfile to build an image named async.

Creating a container

There are many ways to start docker containers. A simple setup that we use is to have a shared directory between the container and the host machine where you are running docker, and forward port 7500 from the host machine to the ssh port (22) in the container. The following command will accomplish this.

$ docker run -d -p 7500:22 -v /path/to/directory:/share async

The /share directory in the container will correspond to the specified path on the host.

Note: a container is like a running machine; if you stop the container using docker, that is the same as powering off a machine. Docker allows you to pause a container, which is useful if you want to leave the machine “in suspension” so that it stops using CPU resources on your system.

At this point, you can connect to the container using the ssh command

$ ssh -p 7500 user@localhost

To connect to a graphical environment in the container, we can use the VNC remote desktop system (e.g. TightVNC). Once you've logged in to the container, run:

$ vncserver

and follow the prompts to setup a password. This will start the vnc server within the container. The vnc server will report a display (usually :1), and the network port it listens to is 5900 plus the display number.

To connect to the running graphical environment within the container, use ssh to connect the container as follows:

$ ssh -p 7500 -L 8500:localhost:5901 user@localhost

Now the local port 8500 on the host will correspond to the VNC port 5901 in the container. You can now connect to port 8500 on your local machine using a VNC client to get a graphical desktop that is running on the container. If the vnc server in the container has a different display number (e.g. :3 instead of :1), then 8500 should be forwarded to a different port number (e.g. 5903 for display :3, rather than 5901 for display :1).

Note that once the container is setup, you don't need to re-do those steps. You can simply pause the container to stop it, and resume it when you want to re-connect to it via ssh.