sassoftware / sas-container-recipes

A collection of recipes and other resources for building containers that include SAS Viya software.
https://www.sas.com
Apache License 2.0
89 stars 42 forks source link

Unable to do docker build inside addons #19

Open alanzablocki opened 5 years ago

alanzablocki commented 5 years ago

Describe the bug I am trying to add the python jupyter support to the base image. I am not sure how to do that using the build.sh script, so I chose to follow the Advanced Build documentation and get the following error:

[azablocki@localhost ide-jupyter-python3]$ docker build --file Dockerfile --build-arg BASEIMAGE=19.04.0-20190516160342-no-git-sha . --tag svc-ide-jupyter-python3 Sending build context to Docker daemon 20.99kB Step 1/15 : ARG BASEIMAGE=viya-single-container Step 2/15 : ARG BASETAG=latest Step 3/15 : FROM $BASEIMAGE:$BASETAG pull access denied for 19.04.0-20190516160342-no-git-sha, repository does not exist or may require 'docker login'

To Reproduce Steps to reproduce the behavior:

  1. Build the auth-demo image as per the quick instructions - I used: ./build.sh --type single --zip ~/path/to/SAS_Viya_deployment_data.zip --addons "auth-demo"
  2. Test the build by logging into SAS Studio with sasdemo user, all works
  3. Descend into the addons directory and the addon you wish to add to the base-image, or any other previously built image with cd addons/ide-jupyter-python3
  4. Run the following command:

docker build --file Dockerfile --build-arg BASEIMAGE=19.04.0-20190516160342-no-git-sha . --tag svc-ide-jupyter-python3

, assuming that BASEIMAGE is the tag that refers to the image just built using step1.

Use docker images to list the images and the tags, to see

REPOSITORY TAG IMAGE ID CREATED SIZE

fbd4d0f5c5db 16 minutes ago 23.4GB sas-container-recipes-builder 19.04.0-20190521150511-no-git-sha 78065ff771ea 19 minutes ago 1.21GB sas-viya-single-programming-only 19.04.0-20190516160342-no-git-sha c00fcda85064 4 days ago 23.4GB sas-container-recipes-builder 19.04.0-20190516160342-no-git-sha 64fe23fad2b0 4 days ago 1.21GB centos 7 9f38484d220f 2 months ago 202MB golang 1.12.0 cee68f119e19 2 months ago 772MB hello-world latest fce289e99eb9 4 months ago 1.84kB Questions: 1. What is wrong with my docker build tag syntax? Step 1/15 suggests it is ignoring my tag completely as it says ( 1/15 : ARG BASEIMAGE=viya-single-container) instead of ARG BASEIMAGE=19.04.0-20190516160342-no-git-sha 2. There are two Dockerfiles (Dockerfile and Dockerfile_http) in the addons directory for jupyter, does this mean I have to run the build twice, and if is in what order? 3. Is there a way to do this using the build.sh script? All the examples I see either do "auth-demo" or at the same time do "auth-demo auth-sssd ide-jupyter-python3", but what if now I wanted to add access-hadoop or any other addon to ide-jupyter-python3? What is the correct way to use build.sh to extend the previously built image? I am assuming that if I pass "auth-demo ide-jupyter-python3 access-hadoop" this will REBUILD the auth-demo and the jupyter addons that I already have? Is that a correct assumption? Or is the build.sh clever enough to know that there are images that already have "auth-demo auth-sssd ide-jupyter-python3"? Thank you. **Expected behavior** The build proceeds as in the simple example and returns docker run instructions **Environment (please complete the applicable information):** [azablocki@localhost sas-container-recipes-master]$ docker version Client: Version: 18.09.6 API version: 1.39 Go version: go1.10.8 Git commit: 481bc77156 Built: Sat May 4 02:34:58 2019 OS/Arch: linux/amd64 Experimental: false Server: Docker Engine - Community Engine: Version: 18.09.6 API version: 1.39 (minimum version 1.12) Go version: go1.10.8 Git commit: 481bc77 Built: Sat May 4 02:02:43 2019 OS/Arch: linux/amd64 Experimental: false
g8sman commented 5 years ago

Thank you for the information. I believe you want to do

docker build --file Dockerfile --build-arg BASEIMAGE=sas-viya-single-programming-only --build-arg BASETAG=19.04.0-20190516160342-no-git-sha . --tag svc-ide-jupyter-python3

This should create an image called svc-ide-jupyter-python3 with a tag of latest.

As far as order, run with Dockerfile and then Dockerfile_http. Given the way the image is tagged on the first builed, remember to change your BUILDIMAGE and BUILDTAG values.

build.sh is calling Docker which then looks at available cached layers to know if it can re-use anything. Running

./build.sh --type full --zip SAS_Viya_deployment_data.zip --addons "addons/auth-demo, addons/ide-jupyter-python3"

and then running

./build.sh --type single --zip SAS_Viya_deployment_data.zip --docker-registry-url <registry url> --docker-namespace <namespace> --addons "addons/auth-demo, addons/ide-jupyter-python3, addons/access-hadoop"

should take advantage of the layers already built for everything up to the access-hadoop layer.

alanzablocki commented 5 years ago

Thank you for your comments. I hope to test the explicit docker command build soon (am a bit stuck trying to deploy the demo to Azure at the moment ). I have three follow on questions regarding the commands you posted above: 1) Why is the type full on the first command and single in the second? Shouldn't they both be the same, and if I want a single, they should both be single, no? 2) Why does the second command use --docker-registry-url --docker-namespace ? 3) When you run a second time, why are you including all the addons like this "addons/auth-demo, addons/ide-jupyter-python3, addons/access-hadoop", instead of just "addons/access-hadoop" Would the latter work on its own (assuming the user did build demo and python support the first time)?

Thank you