Dockercloud-agent error: …Error creating default \”bridge\” network:…

Problem

When trying to use the dockercloud-agent with docker you have the following error in the /var/log/dockercloud/agent.log

Solution

If you remove the file var/lib/docker/network/files/local-kv.db as suggested here, then if you look again at the log files, it should be a message that the docker daemon has been started:

Clearing unused (dangling) docker volumes

Problem

After you start using and building Docker images, there is a case that there is a lot of space used even after deleting images and containers (a few GB maybe).

Solution

To clean out the volumes that are no longer used (ie dangling) use the following:

Removing Docker containers that have exited

Problem

You would like to clear Docker containers that have been exited and not cleared properly.

Solution

Run the following to find out the containers that have exited and remove them.

Error response from daemon: conflict: unable to delete xxx (must be forced) – image is referenced in one or more repositories

Problem

Trying to remove some unused docker images that you no longer use with docker rmi image_id you get the following error message:

Solution

Use the following to delete multiple images (ie ubuntu):

Mentioned here

Starting Phoenix server in a different port than 4000

Problem

You would like start a phoenix application in a port different from the default 4000, by using something similar to the rails:

Solutin

You will need to change the config/dev.exs file to include the following:

and then start the server with:

Taken from the answer here

Routing rspec with nested routes

Problem

You would like to add a routing rspec test in your rails application that tests for a nested route.
So while you have something like the following in your config/routes.rb file:

you want to add the following test for your route:

but you are getting an error like the following:

Solution

You will need to change your rspec to the following using any number for the user_id:

Solution adapted from here

Removing git branches from local repository

Problem

You would like to remove your local branches that were used to track remote branches that no longer exists (deleted after merge).

Solution

To delete your local branch you could use the following:

And to to delete the remote tracking branching you could use the following:

Resetting sequence number in PostgreSQL

Problem

While issuing the query TRUNCATE table TABLE_NAME works for MySQL for restarting the id of the table, this does not work with PostgreSQL.

Solution

In order to restart the sequence of the table in PostgreSQL you will have to issue the following:

from here