Adding a Docker container icon to your Unity launcher (Ubuntu 15.04)

If there’s a Docker container you run a lot it’s nice to be able to single-click an icon on the desktop to run it. This is particularly useful if the container has an interactive shell.

Here’s how to do that for the Unity desktop (Ubuntu 15.04), using the Azure-CLI container as an example. Using this I can click on the desktop any time I want to start a new Azure CLI container. I can type exit in the container to shut it down, or just close the terminal window if I want to attach to it later.

The basic steps are:

  1. Make sure Docker is installed. See
  2. Create a docker group and add yourself to it so you don’t have to sudo each time you want to run docker:
    groupadd dockersudo 
    usermod -g docker myuserid

    Reboot, or at least restart the desktop so when you start a terminal in Unity and run “groups” it says you’re in the docker group.

  3. Create a script to run your docker container. In my case it looks like this:
    docker run -it microsoft/azure-cli

    Make sure the script is executable:

    sudo chmod a+x /opt/
  4. Save the script somewhere e.g.: /opt/
  5. Copy the image you want to use as an icon to /usr/share/icons. E.g. find a small image you want to use on the web and Save-As from your browser to this directory.
  6. Create a desktop file for your container app, and make the “Icon” entry point to your image, and the “Exec” entry point to your script. E.g. for the Azure-CLI container:
    sudo vi /usr/share/applications/azure-cli.desktop
    [Desktop Entry]
  7.  Go to /usr/share/applications in the file manager and drag your icon for your container app into the launcher bar. You can go there directly with this command:
    nautilus /usr/share/applications &

Now you should see the new icon in the launcher:
Launcher bar

When you run the container, in the case of Azure-CLI you’ll be in the interactive shell. E.g. after launching and typing “azure login”:


The following article on adding Minecraft to the Unity launcher was very helpful in figuring out how to do this for Docker containers:

This entry was posted in Containers, Ubuntu and tagged , , , . Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s