Over the last few months I have used Docker more and more. Sometime things go my way, sometimes they don’t. When they don’t, I usually have to Google the command I need to run to get back on track. I decided to compile a list of common Docker commands to solve various issues I run into when working with Docker. This list will grow over time.
Run at your own risk. I am not responsible for copying & pasting without fully understanding what the implications are.
# Show running containers
# Show all containers
# Show all images
# Stop a single container
docker stop<container id>
# Stop all running containers
docker stop$(docker ps-a-q)
# Delete a single container
docker rm<container id>
# Delete all containers
docker rm$(docker ps-a-q)
# Delete a single image
docker rmi<image id>
# Delete all images
docker rmi$(docker images-q)
# Force delete a single image
docker rmi-f<image id>
# Force delete all images (if the above doesn't work)
Recently I had to start hosting a Meteor app on Ubuntu. The process is pretty straightforward however there are a few gotchas. This post is really just to help me remember in the future.
First, clone your repo on the target server or move the source files there before you compile/build the app. This is important if you are using a different OS than what your server is. I ran into issue when compiling it on OSX and moving it to Ubuntu.
After moving the files, install meteor.
curl https://install.meteor.com/ | sh
Then compile your app
It will create a archive for you.
Extract it to the directory you will host the app
cd into the server folder
install node modules
cd back to the app bundle dir
create a process.json file
add your configuration
create a shell script
add bash script
# starts pm2 and watches the process
pm2 start process.json-imax--watch
make it executable
run the bash script
run pm2 startup
this will output a command to run, run it
save current process
All set! Check the status of your app
You should see something similar to this
Also, here is a sample nginx site configuration using Let’s Encrypt SSL
server_tokens off;# for security-by-obscurity: stop displaying nginx version
# this section is needed to proxy web-socket connections
Over the last few weeks I have tinkered with a Raspberry Pi 2 and I have to say it has been pretty fun. I built my Pi with a Zebra case, 32GB micro sd card, a few heat sinks, and a bread board kit so I can easy connect things to my GPIO. I also picked up a TP-LINK TL_WN725N USB NIC for WiFi. I chose this one specifically because it has drivers for both Linux and Windows.
I have gone back-and-forth on which operating system I am going to run on this little device. I have tested Raspbian and Windows 10 IoT core. I ended up settling on both. I have 2 microSD cards, one with Windows 10 IoT core, and one with Raspbian, RetroPie, and OSMC. I used BootBerry boot loader to install multiple version of Linux on the second microSD card.
So far I am sticking with Windows 10 IoT Core, a few reasons:
I am much more proficient at C# than I am python or any other compiled language
Windows 10 IoT can run python and even Nodejs if I choose
Using Visual Studio to deploy and debug directly to my Raspberry Pi is awesome – I am use to this workflow from developing Windows 8/10 and Windows Phone apps
This isn’t an exhaustive list nor is it meant to help anyone make any decisions on what to use, it is just my preference – for the moment at least. We’ll see how things go.
I am hoping to build an LED panel that I can push messages to over http. I have made progress over the last 2 weeks. You can check out some of my code here:
This my Tech PSA for everyone out there not following Windows 10 or tech news in general. Windows 10 launches tomorrow and if you are running Windows 7 or 8, you get it free. So how do you get it? Easy.
Look in the system tray for the Windows logo. For those less tech savvy, that’s the area in the lower right next to the clock.
Click on the Windows logo and follow the prompts to reserve your copy.
Windows 10 should start downloading in the background and as soon as it is released tomorrow you will be able to start the upgrade.
If you’re not sure if Windows 10 is right for you, you can check out all the new features here. My answer is: If you’re running Windows, yes, you want Windows 10.
I finally have push notifications working in Space Weather App from Windows Azure. Notifications for all 4 platforms work using one service bus. This simplifies my architecture and support since all of my infrastructure and services already live in Azure. No more costly 3rd party services.
Today I launched Space Weather App for Android, Apple iOS, and Windows. This means it will run on Android phones & tablets, iPhones, iPads, iPods, and Windows phones & tablets. You can check it out here http://www.spaceweatherapp.com/
Sometimes when debugging a web site you are working on, you want to clear out cookies for a single site however you don’t want to clear out all of your cookies. Some cookies you want to leave there, like your cookies that are set by Gmail/Facebook/Twitter/Outlook.com for 2 factor authentication or many other reasons. Up until now I have cleared them all out each time I need to clear cookies for a single web site I am working on. Here’s how you can clear cookies for a single domain and keep those time saving cookies.
Click on Network
Click Clear Cookies for domain
Click the Chrome menu Chrome menu on the browser toolbar.
Click Show advanced settings.
In the “Privacy” section, click the Content settings button.
In the “Cookies” section, you can change the following cookies settings:
To delete a specific cookie, hover over the site that issued the cookie with your mouse, then click the X that appears on the right corner.
Click the menu button and choose Options
Select the Privacy panel.
Set Firefox will: to Use custom settings for history.
Click Show Cookies…. The Cookies window will appear.
In the Search: field, type the name of the site whose cookies you want to remove. The cookies that match your search will be displayed.
Select the cookie(s) in the list to remove and click Remove Cookie.
Choose Safari > Preferences, and then click Privacy.
Select one website that stores cookies, and then click Remove
A little off topic but I just wanted to share some pictures and a video of our trip to Banff. We flew in to Edmonton, drove to Banff, Lake Louise, and stayed on Canmore. We go to see quite a bit the few days we were there. After a long weekend, we flew back to the States out of Calgary, Alberta.
This is a collection of videos from my phone that I captured while in Banff, Alberta – Canada. Everything was taken using my Lumia 1020 Windows Phone.
ASP.NET Web API is a simple way to create a pretty nice and robust API. I have a need for a simple API and ASP.NET fit the bill. I created an API for my Space Weather application for all of my clients to connect to. The API is pretty simple, it just feeds the clients objects in JSON for them to parse and bind to the UI. After rebuilding my Azure virtual machine, I decided to add some caching to the results. Since Web API doesn’t include an easy way to cache output like MVC did I had to find a solution. For me, the best (an easiest) solution was OutputCaching. It’s super simple to set up.
In my example, I am telling it to cache the results for both client and server-side for 600 sec (10 min). There isn’t a whole lot of science behind choosing 10 minutes, and I could have written some fancy code to figure out when my scheduled job ran last but I wanted to keep it simple.
So, did it really work? Let’s fire up Fiddler and find out. Hit your web endpoint, and take a look:
Sure enough, you can see the client is told to cache for a max of 600 and you can see the ETag letting you know that the server is caching.
So why do I choose to cache my output? Simple. I have a micro virtual machine on Azure and I didn’t want each and every web request to retrieve results from my database creating lots of churn and processing resulting in more disk activity and slower results. Before going and implementing this I suggest you first evaluate your needs. My needs are to return slow changing results to mobile clients as fast as possible without creating a lot of churn on the server. I don’t want my customers to wait for results, especially if the result is the same. My results change 4 times an hour and so caching this is the right thing to do in my scenario. With that being said, I think this NuGet package help me meet this goal.
(Hanselman recommends Cache.Cow, although I like the simplicity and familiarity of decorating my Web API controllers with attributes using CacheOutput.)