New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use Alpine as base Docker image #119

Merged
merged 2 commits into from Oct 18, 2017

Conversation

Projects
None yet
4 participants
@ecliptik
Contributor

ecliptik commented Oct 17, 2017

What this PR does / why we need it:

Reduces size of artifact Docker images by using Alpine Linux, comparisons between ubuntu:16.04 and alpine:3.6

maya: 
ubuntu:16.04 
openebs/maya                 ci                  79b70f1da536        6 seconds ago       141MB 
 
alpine:3.6
openebs/maya                 ci                  e9a5dc4f58e6        7 seconds ago       24MB 
 
maya-apiserver: 
ubuntu:16.04 
openebs/m-apiserver          ci                  ca53afa02d2b        34 seconds ago      210MB 
 
alpine:3.6
openebs/m-apiserver          ci                  3f9a45ae621a        4 seconds ago       82.3MB

Which issue this PR fixes

Fixes openebs/openebs#287

Special notes for your reviewer:

Tested by running both images locally and applications started up properly using Alpine based container.

Use Alpine as base Docker image
Fixes openebs/openebs#287

Signed-off-by: Micheal Waltz <ecliptik@gmail.com>
@codecov

This comment has been minimized.

Show comment
Hide comment
@codecov

codecov bot Oct 17, 2017

Codecov Report

Merging #119 into master will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff           @@
##           master     #119   +/-   ##
=======================================
  Coverage   19.86%   19.86%           
=======================================
  Files          58       58           
  Lines        7419     7419           
=======================================
  Hits         1474     1474           
  Misses       5838     5838           
  Partials      107      107

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 5eb71d9...2974188. Read the comment docs.

codecov bot commented Oct 17, 2017

Codecov Report

Merging #119 into master will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff           @@
##           master     #119   +/-   ##
=======================================
  Coverage   19.86%   19.86%           
=======================================
  Files          58       58           
  Lines        7419     7419           
=======================================
  Hits         1474     1474           
  Misses       5838     5838           
  Partials      107      107

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 5eb71d9...2974188. Read the comment docs.

@kmova

This comment has been minimized.

Show comment
Hide comment
@kmova

kmova Oct 17, 2017

Member

@ecliptik -- that a significant improvement in size!

Couple of questions:

  • Can we still retain installing "watch"?
  • Can you provide a brief comment in there on why we are adding the new packages:
    • mii-tool
    • procps
    • libc6-compat
Member

kmova commented Oct 17, 2017

@ecliptik -- that a significant improvement in size!

Couple of questions:

  • Can we still retain installing "watch"?
  • Can you provide a brief comment in there on why we are adding the new packages:
    • mii-tool
    • procps
    • libc6-compat
@ecliptik

This comment has been minimized.

Show comment
Hide comment
@ecliptik

ecliptik Oct 17, 2017

Contributor

@kmova

There is no watch package in Alpine linux, so it will fail if it's added to the package list. /bin/watch is in the procps package for Alpine which is why it's added. In Ubuntu the watch package is a virtual package to procps as well,

https://packages.ubuntu.com/xenial/watch

The net-tools package in Alpine is comparable to the one in Ubuntu, however mii-tool is in it's own package.

Without libc6-compat the binary will give a "file not found" when trying to run on Alpine since some of the libraries built on a libc6 Linux system (like using when using the Vagrant dev VM) are not available by default on Alpine. Adding this package installs the required libraries for the binary to run on Alpine.

Contributor

ecliptik commented Oct 17, 2017

@kmova

There is no watch package in Alpine linux, so it will fail if it's added to the package list. /bin/watch is in the procps package for Alpine which is why it's added. In Ubuntu the watch package is a virtual package to procps as well,

https://packages.ubuntu.com/xenial/watch

The net-tools package in Alpine is comparable to the one in Ubuntu, however mii-tool is in it's own package.

Without libc6-compat the binary will give a "file not found" when trying to run on Alpine since some of the libraries built on a libc6 Linux system (like using when using the Vagrant dev VM) are not available by default on Alpine. Adding this package installs the required libraries for the binary to run on Alpine.

@kmova

This comment has been minimized.

Show comment
Hide comment
@kmova

kmova Oct 17, 2017

Member

Thanks @ecliptik

Just one more question, earlier (am an year out-dated here), there used to be an "opinion" not to use alpine based images in production. Do you know if this view is changing now? Are there some examples of official docker images moving towards alpine..

Member

kmova commented Oct 17, 2017

Thanks @ecliptik

Just one more question, earlier (am an year out-dated here), there used to be an "opinion" not to use alpine based images in production. Do you know if this view is changing now? Are there some examples of official docker images moving towards alpine..

@kmova kmova requested review from gila and kmova Oct 17, 2017

@gila

gila approved these changes Oct 17, 2017

LGTM

@kmova

This comment has been minimized.

Show comment
Hide comment
@kmova

kmova Oct 17, 2017

Member

@ecliptik - A PR(#116) got merged that resulted in the conflict, could you please update this PR by moving the file from buildscripts/docker/Dockerfile to buildscripts/mayactl/Dockerfile.

Sorry about that :-(

Member

kmova commented Oct 17, 2017

@ecliptik - A PR(#116) got merged that resulted in the conflict, could you please update this PR by moving the file from buildscripts/docker/Dockerfile to buildscripts/mayactl/Dockerfile.

Sorry about that :-(

@ecliptik

This comment has been minimized.

Show comment
Hide comment
@ecliptik

ecliptik Oct 18, 2017

Contributor

@kmova In regards to Alpine in production, we use it in a few different applications and it is stable as Ubuntu. The only major issue we've run into is dns resolution in musl libc when using service discovery within container orchestration. For the most part this has been resolved though (see gliderlabs/docker-alpine#8).

Almost all Docker Official Images have an Alpine variant. The only major difference right now is Alpine does not have full multi-arch support, which should be resolved shortly (gliderlabs/docker-alpine#304).

Contributor

ecliptik commented Oct 18, 2017

@kmova In regards to Alpine in production, we use it in a few different applications and it is stable as Ubuntu. The only major issue we've run into is dns resolution in musl libc when using service discovery within container orchestration. For the most part this has been resolved though (see gliderlabs/docker-alpine#8).

Almost all Docker Official Images have an Alpine variant. The only major difference right now is Alpine does not have full multi-arch support, which should be resolved shortly (gliderlabs/docker-alpine#304).

@ecliptik

This comment has been minimized.

Show comment
Hide comment
@ecliptik

ecliptik Oct 18, 2017

Contributor

@kmova sync'd with master and Dockerfile is in the correct directory now

Contributor

ecliptik commented Oct 18, 2017

@kmova sync'd with master and Dockerfile is in the correct directory now

@kmova

kmova approved these changes Oct 18, 2017

Many many thanks @ecliptik - for this feature enhancement as well as the detailed notes that makes a good case for using alpine images.

@kmova kmova merged commit d87fedd into openebs:master Oct 18, 2017

3 checks passed

codecov/patch Coverage not affected when comparing 5eb71d9...2974188
Details
codecov/project 19.86% remains the same compared to 5eb71d9
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
@prateekpandey14

This comment has been minimized.

Show comment
Hide comment
@prateekpandey14

prateekpandey14 Oct 19, 2017

Member

@ecliptik , I still see some issues with DNS resolution in alpine (understood as much from the thread referred as well ). Here is my resolv.conf :

nameserver 10.0.0.10
search default.svc.cluster.local svc.cluster.local cluster.local cbblr.com
options ndots:5

The issue renders even the CLI commands on the maya container way too slow (confirmed by setting the nameserver to 127.0.0.1, which immediately restores the speed - but we don't want this, right)

/ # date;maya;date
Thu Oct 19 15:23:40 UTC 2017
Usage: maya [--version] [--help] <command> [<args>]

Available commands are:
    snapshot    Provides operations related to snapshot of a Volume
    version     Prints version and other details relevant to maya
    volume      Provides operations related to a Volume

Thu Oct 19 15:24:02 UTC 2017
/ #
Member

prateekpandey14 commented Oct 19, 2017

@ecliptik , I still see some issues with DNS resolution in alpine (understood as much from the thread referred as well ). Here is my resolv.conf :

nameserver 10.0.0.10
search default.svc.cluster.local svc.cluster.local cluster.local cbblr.com
options ndots:5

The issue renders even the CLI commands on the maya container way too slow (confirmed by setting the nameserver to 127.0.0.1, which immediately restores the speed - but we don't want this, right)

/ # date;maya;date
Thu Oct 19 15:23:40 UTC 2017
Usage: maya [--version] [--help] <command> [<args>]

Available commands are:
    snapshot    Provides operations related to snapshot of a Volume
    version     Prints version and other details relevant to maya
    volume      Provides operations related to a Volume

Thu Oct 19 15:24:02 UTC 2017
/ #
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment