Tag Archives: howto

Docker Tips

I’ve been working with Docker the past few months and all-in-all, I’ve been very pleased with the quality of the documentation. But, as with any other tool, there are always a few tricks to pick up, particularly when trying to script things out for an automated build or deployment. I’ve listed some of the more useful ones below and will update this post as I learn new ones.

Note: These are mainly oriented around running Docker in a Linux environment, as that’s where I’m currently using it.

How do I stop typing sudo all the time?

Docker runs as root, so when you’re working with an out-of-the-box installation, the docker command must be preceded by sudo. Since it may not be desirable for all Docker users to be able to execute commands as root, the installation creates a docker group. Members of the group may execute docker commands without elevated privileges.

To add users to the group, execute the command:
sudo usermod -aG docker <username>

How do I remove all stopped containers?

When a container is stopped, it remains loaded. You can remove it by issuing the command docker rm container_name, but that can be a hassle if you have a large number of containers loaded and they all have random names (a frequent occurrence when you’re first learning Docker).

You can remove all stopped containers by executing the command:
docker rm $(docker ps --quiet -a --filter status=exited)

(The –filter option prevents errors from attempting to remove containers which are currently running.)

You can also cause your containers to remove themselves automatically by including the –rm option on the docker run command line.

How do I know if a container is running?

To determine if a named container (e.g. “clever_leakey”) is currently running

containerID=$(docker ps --quiet --filter status=running --filter name=clever_leakey)

if $containerID is non-null, the named container is running. If it’s null, then the container is no longer running.

Do note however that there are other non-running states, e.g. paused, which will also return a null containerID for this test. As an alternative, to find only the containers which are stopped, use status=exited.

If the docker run command includes the –rm option, the container will be removed from memory.

(Image via openclipart under Creative Commans CC0 1.0 Universal)

Stopping Credit Card Offers

It seems like the mail includes a good number of credit card offers. Various companies seem to send offers for their special Visa or Mastercard affinity programs almost daily. It only takes a moment to run them through the shredder, and the fees for sending them help keep the lights on at the Post Office. Besides, figuring out how to stop them takes too long, right?

But Thursday’s daily email included something special! A credit card offer with the magic phrase, “You can choose to stop receiving “prescreened” offers of credit from this and other companies by calling toll-free 1-888-567-8688.” Now I’m suspicious of pretty much any offer that comes in as a spam email (These turkeys weren’t even supporting the Post Office!) but a Google search is pretty painless.

The second result was the US Federal Trade Commission’s “Prescreened Credit and Insurance Offers” page. So what do you know? That phone number’s legit.

So it turns out there are actually three options:

  1. Call 888-567-8688 and you can stop (most) credit card offers for five years.
  2. You can also stop (most) credit card offers by visiting https://www.optoutprescreen.com/, clicking the “Click Here to Opt-In or Opt-Out” button.
  3. Or you can go for the gold by visiting that same link, printing out the form at the end, and mailing it to
    Opt­Out Department
    P.O. Box 2033
    Rock Island, IL 61204­-2033

    .

Total time spent: less than five minutes.

(Image via pixabay)

How To Leave a Facebook Group Message

A friend mistakenly started a massive (50? 100?) group message on Facebook. After the initial admission of “I created this by mistake,’ people started replying (to all) that they would like to be removed (which is something you have to do yourself) and others began asking, “How do you do leave a group message?”

Below are the steps for doing this from the full version of the Facebook website. The mobile site doesn’t seem to offer this functionality and while this can probably be done from the mobile app, I don’t use it so can’t provide much guidance.

  • Click on “Messages” on the left hand side.
  • Click on the message you want to leave.
  • At the top of the screen, there’s a box labeled “+ New Message.”
  • Next to that, there’s a smaller box with what looks like either a gear or a sunburst. Click that.
  • A list of options will appear.
  • Click “Leave Conversation.”
  • Confirm that you want to leave.