Building a docker image from scratch

Building a docker image from scratch

Docker logo

This post assumes that you have a working docker environment already set up.

Here are the really simple instructions:

  1. create a Dockerfile
  2. open the Dockerfile
  3. add a FROM statement with a base image
  4. add a RUN statement for running whatever setup commands are needed
  5. add any additional RUN statements necessary
  6. add a COPY statement for copying stuff over from the local filesystem
  7. run docker build -t user/image_name:v1 .
  8. run docker run user/image_name:v1

Dockerfile

testfile

The following is the contents of testfile:

this is a test file

As you’re writing your Dockerfile, it may be helpful to run the commands against a real image as you go, so that you can more easily predict what’s happening. Here is how to do that:

docker pull debian:latest
docker run -t -i debian:latest /bin/bash

If you want to generate a docker image based off of what you did in the interactive session vs a Dockerfile, you can take note of the image id in the console after root. E.g. root@28934273 # specifies the user is root and the image id is 28934273. Then, you can run whatever commands you’d like, exit the session, and run the following:

docker commit -m "ran some commands" -a "My Name" \
28934273 user/debian:v1
  • -m is the commit message
  • -a is the author’s name

Now, you can run that image:

docker run -t -i user/debian:v1

You can use the image you just created as a base image in another of your Dockerfiles, so that you can interactively set up your image initially, and then in the second step, add any CMD statements to actually run your software.

Refernces

Documentation pulled from:

Code

Clone from GitHub

Rick and Morty Game

Wow, Rick and Morty have a game on… Instagram. I’m sure others have done this before, but it’s the first of its kind that I’ve seen, and is really slick.

If you visit the profile page, it’s got a large mosaic image. Go into one of the images, and see if there’s a tag to another profile. Click on the other profile, and go to a new profile with a new mosaic, with something new to explore.

Check it out here!

super widescreen

A photo posted by Rickstaverse Instructions (@rickstaverseinstructions) on

Andreessen Horowitz - What's going on

What’s going on with US tech funding?

U.S. Technology Funding -- What's Going On? from a16z

Using Cardboard with unsupported VR viewers

Using Cardboard with unsupported VR viewers

Google Project Tango

The Project Tango booth at Google I/O 2015

On Saturday, I was hanging out with some friends at the SFVR Project Tango Hackathon & VR Expo. The Tango team had handed out Tango devices and Durovis Dive 7 VR masks to develop with. I was feeling pretty dead from Google I/O, and the surrounding parties, but Etienne Caron and Dario Laverde were busy doing their best to build something on the Tango using the Cardboard SDK. They both fired up demos, and immediately found an issue. The screen was not configured correctly for the device, or the viewer.

Google Cardboard

Giant Cardboard hanging at Google I/O 2015

It turns out that Cardboard expects a configuration that is typically provided by the manufacturer of the viewer, but the Dive doesn’t come with one. Etienne noticed that there was nothing documented in the Cardboard API that related to screen or viewer configs. He and I started to poke at the debugger, trying to figure out if we could find the place that those values get set. We traced it back to a file on the sdcard, but when we looked at it, we realized that it was in serialized protobuf format. My initial thought was to copy the files that read the protobuf and decode the file, but we realized that there was an easier way, the Cardboard View Profile Generator.

Etienne and I generated config files, and Dario helped us test. Dario was also working on some other Cardboard related issues. Here’s what we did:

  1. Visit the View Profile Generator from Chrome on a computer that’s not the tablet you’re trying to configure.
  2. On the tablet, in Chrome, visit the shortlink shown on the main page.
  3. On the tablet, if your instance doesn’t go full screen all the way (if you can see the nav bars), install GMD Full Screen Immersive Mode from the Play Store.
  4. Install the phone/tablet in the viewer.
  5. Back on the computer, hit ‘Continue’.
  6. Using the tool, you can dynamically configure the view settings. The tablet screen is synced up with the tool, so the changes should appear on the tablet in real time. (It uses Firebase!) dynamically resizing screen
  7. Follow the instructions on each field, and watch the changes on the screen. You can tweak them until you have something that looks good to you. Here’s the config that I generated.
  8. Next, you should be able to generate your profile. final screen config
  9. In your Cardboard app, you should be able to scan the QR code in the setup step of Cardboard, or go to Settings.
  10. If you’re on the Tango, you will need to go through one extra step, the camera that attempts to scan the QR code doesn’t work right, so you will need to use a second device.
  11. After scanning from the second device, plug it into a computer with adb installed, and run the following command: adb pull /sdcard/Cardboard/current_device_params ./
  12. Then, plug your tablet in, and push the config that you generated: adb push current_device_params /sdcard/Cardboard/current_device_params
  13. Fire up the Cardboard app on your tablet and check it out! Cardboard demo
  14. If it needs tweaking, just repeat steps 6-12.

Here’s the final config file that I generated.

What's new in Android Development Tools

What’s new in Android Development Tools

  1. Design Tools
  2. Faster Emulator
  3. NDK

Design

Android Design Support Library, backwards compatible.

Vector drawables

Auto-generate the correct asset sizes at build time, may decrease apk size. Allows adding tint programtically (check on that one).

Visual Design Editors

Don’t need to rely solely on xml editors.

Develop

Gradle Plugin post 1.0

  • Correctness
  • Performance
  • NDK
  • Testing

Build Steps Performance

  • Jack
    • compiles straight from Java to Dex file
  • PNG Cruncher
    • much faster
  • Coming: aapt

Gradle Overhead

  • Building the Model
  • Flavor Build Type Variants
  • …?

Next Gen Gradle Plugin

  • Do less
  • Cache what doesn’t change
  • More optimization/parallelism

However, if dependencies change, wondering if those projects need to be explicitly rebuilt, or if Gradle will pick up that there’s a change.

  • Similar DSL
  • Preview in a few weeks
  • Final later this year

Data Binding

  • Build time support
  • Experimental plugin for now
  • Will move to 1.3 plugin before release

NDK C/C++ Support - Gradle

  • Based on Native Support in Gradle
  • Next Gen Plugin only for now

NDK C/C++ Support - Studio

  • Based on CLion from JetBrains
  • Debugging & Refactoring
  • Free for Android Development

Support for C/C++ in Studio looks very similar to Java support. Many of IDE’s utilities can be used in the same way for NDK stuff. JNI is also supported.

Unit Test Support

  • Runs on Desktop JVM
  • All Android Code must be mocked
  • src/test/java

Test story

  • Android Studio
  • Android Testing Library
  • Cloud Test Lab
  • Google Play Testing

Emulator

  • Working on Performance and Stability
    • Auto-installs HAXM
    • Fixed thousands of issues in GL renderer
  • Test M Developer Preview Features

Android Auto Emulator

New version of the Auto Emulator coming.

Annotations in Studio

Annotations can help to enforce certain assumptions about threading. It can help with array sizes, and float ranges. This means that you can specify if a primate array is expected to be of length 2, that if an array is passed in that has a different size, it can warn you or fail on that. This can also be used for M’s new permissions requirements.

Debugging

There are new debugging tools that allow you to get more useful information about variables listed in the debugger, and dig through the code to find what they relate to. May require Annotations.

Data Binding

Maps ‘find view by id’ to something more sane.

Battery Performance on Android

Battery Performance for Android

Colt McAnlis | +ColtMcAnlis | @duhroach

#perfmatters

The more things you do, the more battery you use.

A study by Purdue University showed that only 25-30% of battery usage is for intended use. The other 70% is being eaten by other things like GPS, Ads, etc.

Defer work until the best time for battery

Battery Problems

Networking

There’s a round trip that may happen if you wake up the chip to do a network request. If you wake up the device to make a network request, it sends a packet to the server, then waits for some period of time for the server to send a response. There is a 20-60 second keep awake time that happens during these events.

Batch & Delay - Delay XHR requests until you can do them all together, then get only one wait time. This can result in a 5-6x increase in battery life.

Check out Battery Historian, so that you can take a look at what’s waking up the chip, and hitting the battery.

Wakelocks

Don’t do that! They don’t get released, and make Colt bald. Instead, try AlarmManager.setInexact().

Location

Very expensive. Using Cell Network Provider instead of GPS, but less accurate. Figure out which is necessary for what the user actually needs.

Turn down resolution while the phone is sleeping. Using passive providers can also help.

Job Scheduler

Use this too!

Containers to back your mobile app

Containers to back your mobile app

Brian Dorsey | +BrianDorsey | @briandorsey

How to run backend systems for mobile apps.

Why have a mobile backend at all? It enables you to do things that you couldn’t do without a backend.

It’s a pain.

VM - Cluster -…

Containers

Nice way to wrap up Linux binaries, and make it portable. So it doesn’t just “work on my machine”. Runs everywhere.

Kubernetes

Manage applications, not machines.

Written mostly in Go, initial effort by Google. Open Source.

Helps making deployments, testing, and management more sane.

Uses a yaml config file, specifies number of instances, basic information on how to make copies, and image that we’re using. Sounds like a way to automate mini versions of AMIs.

 # launch using nautilus.yaml config
 kubectl create -f nautilus.yaml

 # resize to 6 instances
 kubectl resize rc update-demo-nautilus --replicas=6

 # upgrading the fleet is very simple
 kubectl rolling-update ...?

Wondering about what happens when you have long-running processes, that require some specific steps. This can be done by writing your own process for doing those updates. Can be written based on any criteria in your system.

  • Labels
    • Arbitrary metadata
    • key-value pair
    • generally represent identity
  • Pods
    • Small group of containers
    • Tightly coupled same node
    • atom of cluster scheduling and placement
    • shared namespace (IP and localhost)
    • ephemeral
  • Replication / Control loops
    • Drive current state -> declared desired state
    • act independently
    • APIs
    • Observed state is truth
    • reoccurring pattern in system
  • Services
    • group of identical pods
    • Load balanced traffic to healthy pods
    • Stable IP and DNS name
    • This is the discovery mechanism for Kubernetes

Google Container Engine

Google provides this in Google Container Enginer. Approaching 1.0, but not there yet.

IO15 Keynote

Setting the Stage - IO15 Keynote

We walked into a room with a wraparound display around three-quarters of the large room on the third floor of Moscone, that was showing a slick looking wallpaper with floating graphs, and ones and zeros. The wallpaper animation was interrupted for a few games of pong played from end to end on what must be a five hundred foot long display. From there, we saw a Rube Goldburg running on the screen, where they took advantage of the fact that it had been filmed, and took sections in slow motion. The music was building up to what we assumed would be a massive payoff, but then near the end, the screen filled with water, and a giant whale swam across the screen. More pong, and floating ones and zeros, and waiting for things to get started. The Pong finals ended in a tie. Now we’re flying through the galaxy, floating past asteroids that appear to be way too close together. Earth shows up and fades out to applause, then we are transitioned into a countdown that starts from 60, counts down to 7, at which point we see a reddit alien and twitter birds, uber cars in an animation that looks like it belongs as the intro to Silicon Valley. This part of the animation features a red dot in the starring role. I wonder how much 7-up paid for this promotional spot? The red dot fixes the countdown and then fireworks.

9:41am - Start Time

Sundar walks onto stage. He’s trying to weave a consistent story around all of Google’s core technologies. I’m not sure how true it is, but it makes for a nice story.

Quick rundown of platforms that we’ll be touching on:

  • Android
  • Android Wear
  • Android Auto
  • Android TV
  • Chromecast
  • Android M Developer Preview

HBO Now announced for Google Play, Silicon Valley gets a mention! Yay!

Android M Developer Preview

9:49am

App Permissions

Customize and control, app permissions. App permssions changing to the iOS paradigm, WhatsApp used. No permissions up front, first time use, microphone permissions comes up. Permissions may be revoked. Only applies to apps targeted at M. No auto-update blocking on new permissions. This is huge.

Mobile Web

Providing content in WebViews kind of sucks. Chrome Custom Tabs are the solution. Chrome browser running with branded UI features when linked from an app, creates a seamless experience. Pre-fetching content. Leverage all of Chrome’s goodies. Q3.

Verify that the app owns the links that it claims. No more disambiguation dialog, because the platform can verify those links.

Mobile Payments

Android Pay, what about Wallet? Works with any Android device with NFC. Works at any retailers that accept touchless payments (does that mean all Apple Pay providers?). Also in-app.

  • Simplicity
  • Security
  • Choice

KitKat forward.

Fingerprint Support

Built-in fingerprint support in Android M with a standard API. Works with Android Pay. Can be used to unlock, or do in-app purchases. Open APIs. Nexus 6 support???

Power & Charging

Smarter power management with Doze. Uses motion detection to exponentially back-off network activity to extend battery life on devices that are lightly used, or left on the table for most of th day. Still allows high-priority chat messages through. Up to 2x battery life on Nexus 9.

3-5x faster charging with USB C, which sounds like it’s going to be the new standard. Working with OEMs.

Word Selection

Word chunking in selection.

Easier sharing

Direct share, remembers who/what you share with most frequently to surface intelligently.

Simplified Volume Controls

All audio streams available from one thing.

M image

10:06am

Contains lots of keywords.

Android Wear

10:06am

Over 1500 watchfaces! Yay!

Key platform investments. Most recent release (already announced) includes:

  • ALways-on Apps
  • Wifi
  • New Launcher
  • Emoji recognizer
  • Wrist gestures
  • Maps API
  • Screen Lock

Key principles:

  • Glanceable
  • Actionable
  • Effortless

Always-on apps

Shopping list example, which is great, since I’ve hit this use case. Previous version kept the screen at full on brightness if you wanted your list up. Claim that it’s battery friendly, we’ll see.

Wrist gestures

Scroll through lists or Now Cards when hands are full, using gestures.

Emoji

Draw an emoji, get a list to pick from.

Uber

Uber is coming! “Call a car”, now can call an Uber, and watch the car coming with the always-on screen.

Fit

Can recognize squats, pushups and situps.

Spotify

Browse music on the watch.

Apps

4,000 specifically targeting Android Wear.

IoT/Brillo

10:15am

Sundar’s back on stage. Talking IoT/Home.

Want to connect everything.

Home

Smart blinds. Smart potted plant.

Agriculture

Smart Grass. Smart dirt.

Transportation

Smart bus drivers.

Problems

OEMs not sure how to build coherent platforms.

Nest

Division that’s going to solve this problem is Nest.

  • User Experience
  • Communications
  • Operating System

Brillo

10:17am

Operating system for IoT. I’m sure I’ll be saying that word a lot over the summer.

  • Derived from Android
  • Minimal system requirements
  • Broad silicon support
  • Easy to secure

Q3 Developer Preview

Weave

10:19am

  • Developer APIs
  • Cross Platform

Messaging layer for communicating between smart devices. Looks like JSON, though I’m sure it’s going to be a low-level binary format. Standardized schemas, custom schemas will be able to be submitted for approval.

Q4 2015 Full Stack.

Mobile Search and Google Now

10:22am

  • Natural Language Processing
  • Image Recognition
  • Translation
  • Machine Learning

Deep Neural Nets

10:23am

Word error rate from 23% -> 8%.

Google Now

More contextual. Why can’t your smartphone be smarter? Where did I park my car?

  • Context
  • Answers (proactively)
  • Action

Context

Different contexts means different information is useful. Being at Disney World vs sitting on your couch.

Understanding pronouns, through context awareness:

  • “It”
  • “There”
  • “That”
  • “They”

Answers

Knowledge graph. 1B entities in the knowledge graph.

Action

Get stuff done with apps. 100+ partners that surface actions from apps. Order an Uber. Play music. Re-order groceries.

Now on Tap

10:31am

Where you are, when you need it. Coming in Android M.

Long press the Home button, Google Now surfaces contextual information without leaving the app you’re looking at.

Viber getting demoed. Shows Google Now picking out two relevant pieces of information and providing actions based on those bits of info. NLP very good to pick out the dry cleaning reminder.

Google Now was able to correct mis-pronounciations based on what’s on the screen. This has been an issue, but the context helps the system correct the issue.

We need to provide actions for Now hooks to take advantage of.

Photos

10:38am

Machine learning. Trying to solve the issue of scrolling and scrolling to find what you’re looking for.

Google Photos

Launched for the 5th time? Looks like the old Photos.

Home

Home for all your photos and videos. To help organize and bring moments to life. Make it easy to share and save what matters.

Home for your photos. Auto-backup. Synced to Drive (instead of G+). Pinch across months/years. Looks a bit like iOS’s iPhoto (or whatever) feature. Swipe for collections. Seems very gesture heavy.

Organize

View people places and things. Sorted for you, privately. They’re Tweeting. G+ not very high up on the list.

For people, they’re able to look from the time his 5 year old was a baby, and they’re all categorized correctly. That’s impressive.

Search is also very impressive.

Actions

Editing, but also being able to easily put together stories, etc.

Photos Assistant. Auto-awesome v2. GoPro footage looks terrible.

Gesture for pressing and dragging to select similar to how desktops do it. “Get a link”, lets you create an album for anyone to consume without logging in. Allows you to add album to your library as the recipient.

Unlimited Free Storage

High quality up to 16MP photos, 1080p video.

Launching today! Android, iOS, and Web.

http://photos.google.com

Emerging Markets

10:51am

8 of 10 new phones shipped are Android. (1.2B+ expected to ship next year, 80% of that is 960M.)

Translate

Intended as a fundamental service to help people communicate. For the next billion people coming online, mobile first.

Android One

Available in 7 countries. Dual Sim, replaceable battery, built-in radio. Running latest version of Android.

Chromebook

Targeting emerging markets. Under $150 for low end devices, that provide a high quality experience.

Core apps

Fast, useful, relevant.

Access to “good” information can be transformative.

Connectivity challenges, data costs.

Light search results page shown in countries that typically have slow connections. Optimized web pages: 4x faster, 80% fewer bytes, 80MB reduction in memory usage.

Network quality estimator

Adapts webpage quality to current connection. Offline in Chrome on Android. Able to save pages for later.

YouTube offline

Save videos for up to 48hours.

Maps

Mapmaker? Local results improvements.

Transit coming to new areas.

Offline maps! Search with auto-complete, reviews, hours, and basic information. Navigation offline. Coming later this year.

Check out “Konga” (Africa’s Alibaba).

Cross-Platform Development

11:08am

  • Identity
  • Location
  • Cloud
  • Analytics
  • Engagement
  • Monetization

Develop

Android Studio 1.2, with full support for C/C++. Available on Canary.

Polymer 1.0. Lots of common elements as stock pieces.

iOS CocoaPods as the default distribution channel for Google libraries.

Testing - Cloud Test Lab. Leverages acquisition of Appurify. Coming ot Google Developer Play Console. Upload apk (with tests?), get back report and video.

Firebase used by 190k apps.

Engage

App Indexing, integrate app content into Google Search results, and allows uers to install from search results. Free.

Cloud messaging (GCM), adding iOS, and Topic subscriptions.

Mobile web - OS level notifications from websites. Add bookmark to homescreen.

App install ads. Universal app campaigns. In Developer Console in a few months.

Measure Install Ads, now both for Android and iOS. Cross-network with lifetime value attribution. Open, transparent, reliable.

Google Play Developer Console - adding views to the funnel, so you can see views -> installs -> …

A/B test Google Play listings. Includes app icon.

New Developer Pages, coherant company view.

Earn

AdMob integrated Analytics.

AdMob mediation, allows ads from 40 other networks (including Tencent?!?) to run through AdMob ads.

http://developers.google.com

Google Play

11:20am

  • 50B installs in past 12 months
  • 1B active users

Games

Lots of interest in games on Android.

Personalization

Personalized Store, 2x more likely to get app installs.

Search

Group results by category. E.g. shopping -> fashion, coupons, …

Families

Family discovery experience, the Family Star. Content ratings.

Family section of store. Browse content by age. Browse by popular characters.

Ad supported or in-app-purchases are labeled.

Udacity

11:25am

Android Nanodegree. 6 month course, $200/mo.

Cardboard

11:26am

Ecosystem of manufacturers, hundreds of apps. 1 million cardboard viewers.

What’s next

Cardboard and VR.

New viewer. Fits more phones, up to 6 inches. Physical cardboard button, fewer steps. Free cardboard!

Cardboard SDK

Supports Android and iOS

VR in the classroom

11:31am

Expeditions.

Synchronized from teacher to students. Allow classrooms to take a field trip in minutes.

Jump

Capturing 360 VR Video.

  • Camera Geometry
  • Assembler
  • Player

GoPro will build and sell Jump ready rig.

Stitching is impressive, trying to create true VR video, that understands objects, and allows more movement within video. When you move, it demonstrates the depth.

YouTube will support Jump this summer using Cardboard. YouTube currently supports non-stereoscopic 360 content.

Moonshots

11:42am

Moonshots are at the heart of Google.

Driverless cars

3200 deaths due to auto accidents. Self-driving cars have not caused a single accident thus far in the thousands of hours of trials.

Loon

Wants to bring the next billion users online. 100+ days in the air (beating NASA’s old record of 50 days), LTE (10mbps) speeds, 500m accuracy, 4x coverage area. Local partners.

Smashed Apple Watch

smashed apple watch

Image from Weibo

Some people have been reporting that their Apple Watch screens are breaking easily.

I cannot imagine that Apple didn’t both test this, and know that this was likely to happen. This is the sort of thing that will very quickly put a damper on enthusiasm for a new form factor. Apple has not been handling this particularly well either. I saw one guy quote Apple saying that it would cost him over $200 to repair.

I’ve knocked my Moto 360 more times than I can count, and not a scratch. I actually could not find any images of a 360 with a cracked screen.

I’m not bringing up the 360 to say that it’s better, so don’t buy the Apple Watch, rather that it’s possible to have a smartwatch that isn’t likely to have issues with the screen breaking. What’s more, traditional watches have been handling this case just fine for generations.

Anyways, if you are going to buy an Apple Watch, be careful with it!

How to Start a Startup

For anyone who’s curious about startups, there is an excellent podcast series called “How to Start A Startup” (first episode in video form is the above video). It’s a Stanford class, run by Y Combinator (the premier startup accelerator, of which TiKL is an alum), and it goes through just about every conceivable aspect of how to start a startup.

While all of the content applies to the specific type of company that startups are, there are really excellent episodes on all sorts of things that people with different interests, and roles will find useful. From managing, to getting a new company off the ground, to figuring out how to build a product that people are going to love.