Skip to content

Latest commit

 

History

History
198 lines (166 loc) · 10.5 KB

appdeploy-private.md

File metadata and controls

198 lines (166 loc) · 10.5 KB
copyright
years
2020, 2021
lastupdated 2021-09-01
keywords applications in code engine, apps in code engine, http requests in code engine, deploy apps in code engine, app workloads in code engine, deploying workloads in code engine, application, app, memory, cpu, environment variables
subcollection codeengine

{:DomainName: data-hd-keyref="APPDomain"} {:DomainName: data-hd-keyref="DomainName"} {:android: data-hd-operatingsystem="android"} {:api: .ph data-hd-interface='api'} {:apikey: data-credential-placeholder='apikey'} {:app_key: data-hd-keyref="app_key"} {:app_name: data-hd-keyref="app_name"} {:app_secret: data-hd-keyref="app_secret"} {:app_url: data-hd-keyref="app_url"} {:audio: .audio} {:authenticated-content: .authenticated-content} {:beta: .beta} {:c#: .ph data-hd-programlang='c#'} {:c#: data-hd-programlang="c#"} {:cli: .ph data-hd-interface='cli'} {:codeblock: .codeblock} {:curl: #curl .ph data-hd-programlang='curl'} {:curl: .ph data-hd-programlang='curl'} {:deprecated: .deprecated} {:dotnet-standard: .ph data-hd-programlang='dotnet-standard'} {:download: .download} {:external: .external target="_blank"} {:external: target="_blank" .external} {:faq: data-hd-content-type='faq'} {:fuzzybunny: .ph data-hd-programlang='fuzzybunny'} {:generic: data-hd-operatingsystem="generic"} {:generic: data-hd-programlang="generic"} {:gif: data-image-type='gif'} {:go: .ph data-hd-programlang='go'} {:help: data-hd-content-type='help'} {:hide-dashboard: .hide-dashboard} {:hide-in-docs: .hide-in-docs} {:important: .important} {:ios: data-hd-operatingsystem="ios"} {:java: #java .ph data-hd-programlang='java'} {:java: .ph data-hd-programlang='java'} {:java: data-hd-programlang="java"} {:javascript: .ph data-hd-programlang='javascript'} {:javascript: data-hd-programlang="javascript"} {:middle: .ph data-hd-position='middle'} {:navgroup: .navgroup} {:new_window: target="_blank"} {:node: .ph data-hd-programlang='node'} {:note: .note} {:objectc: .ph data-hd-programlang='Objective C'} {:objectc: data-hd-programlang="objectc"} {:org_name: data-hd-keyref="org_name"} {:php: .ph data-hd-programlang='PHP'} {:php: data-hd-programlang="php"} {:pre: .pre} {:preview: .preview} {:python: .ph data-hd-programlang='python'} {:python: data-hd-programlang="python"} {:release-note: data-hd-content-type='release-note'} {:right: .ph data-hd-position='right'} {:route: data-hd-keyref="route"} {:row-headers: .row-headers} {:ruby: .ph data-hd-programlang='ruby'} {:ruby: data-hd-programlang="ruby"} {:runtime: architecture="runtime"} {:runtimeIcon: .runtimeIcon} {:runtimeIconList: .runtimeIconList} {:runtimeLink: .runtimeLink} {:runtimeTitle: .runtimeTitle} {:screen: .screen} {:script: data-hd-video='script'} {:service: architecture="service"} {:service_instance_name: data-hd-keyref="service_instance_name"} {:service_name: data-hd-keyref="service_name"} {:shortdesc: .shortdesc} {:space_name: data-hd-keyref="space_name"} {:step: data-tutorial-type='step'} {:step: data-tutorial-type='step'} {:subsection: outputclass="subsection"} {:support: data-reuse='support'} {:swift: #swift .ph data-hd-programlang='swift'} {:swift: .ph data-hd-programlang='swift'} {:swift: data-hd-programlang="swift"} {:table: .aria-labeledby="caption"} {:term: .term} {:terraform: .ph data-hd-interface='terraform'} {:tip: .tip} {:tooling-url: data-tooling-url-placeholder='tooling-url'} {:topicgroup: .topicgroup} {:troubleshoot: data-hd-content-type='troubleshoot'} {:tsCauses: .tsCauses} {:tsResolve: .tsResolve} {:tsSymptoms: .tsSymptoms} {:tutorial: data-hd-content-type='tutorial'} {:ui: .ph data-hd-interface='ui'} {:unity: .ph data-hd-programlang='unity'} {:url: data-credential-placeholder='url'} {:user_ID: data-hd-keyref="user_ID"} {:vbnet: .ph data-hd-programlang='vb.net'} {:video: .video}

Deploying application workloads from images in a private registry

{: #deploy-app-private}

Deploy your app with {{site.data.keyword.codeengineshort}} that uses an image in a private registry such as private Docker Hub. You can create an app from the console or with the CLI. {: shortdesc}

Before you begin

To pull images from a private registry, you must first create a private registry. For example, to create a private Docker Hub registry, see Docker Hub documentation{: external}. After you create a private registry, push an image to it{: external}. You can also set up an access token. By using an access token, you can more easily grant and revoke access to your Docker Hub account without requiring a password change. For more information about access tokens and Docker Hub, see Managing access tokens{: external}.

Deploying an app that references an image in private registry with the console

{: #deploy-app-private-console}

Deploy an application that uses an image in a private registry with the {{site.data.keyword.codeengineshort}} console. {: shortdesc}

Before you can work with a {{site.data.keyword.codeengineshort}} application that references an image in a private registry, you must first add access to the registry, pull the image, and then deploy it.

  1. Open the {{site.data.keyword.codeengineshort}}{: external} console.
  2. Select Start creating from Run your container image.
  3. Select Application.
  4. Enter a name for the application; for example, helloapp. Use a name for your application that is unique within the project.
  5. Select a project from the list of available projects. You can also create a new one. You must have a selected project to deploy an app.
  6. Select Container image and click Configure image.
  7. Enter docker.io for Registry server.
  8. From Registry access, select Add registry access.
  9. From the Add Registry Access page, choose your registry source. For example, DockerHub.
  10. Enter a username. For Docker Hub, it is your Docker ID.
  11. Enter the password. For Docker Hub, you can use your Docker Hub password or an access token. For more information about access tokens and Docker Hub, see Managing access tokens{: external}.
  12. Click Create to add the registry access for {{site.data.keyword.codeengineshort}}.
  13. From the Select image page, the registry that was added is listed. Select the registry of your image.
  14. Select the namespace and name of the image in Docker Hub for the {{site.data.keyword.codeengineshort}} app to reference. For example, select mynamespace and select the image hello_repo in that namespace.
  15. Select a value for Tag; for example, latest.
  16. Click Done.
  17. Modify any runtime settings or environment variables for your app. For more information about these options, see Options for deploying an app.
  18. From the Create application page, click Create.
  19. After the application status changes to Ready, you can test the application by clicking Send request. To open the application in a web page, click Open application URL.

If you want to add registry access before you create an app, see Adding access to a private container registry.

Looking for more code examples? Check out the Samples for {{site.data.keyword.codeenginefull_notm}} GitHub repo{: external}. {: tip}

Deploying an app with an image from a private registry with CLI

{: #deploy-app-private-cli}

Deploy an application that uses an image in a container registry with the CLI with the ibmcloud ce app create command. {: shortdesc}

Before you can work with a {{site.data.keyword.codeengineshort}} application that references an image in a private registry, you must first add access to the registry, pull the image, and then deploy it.

  1. To pull images from a private registry, you must first create a private registry. For example, to create a private Docker Hub registry, see Docker Hub documentation{: external}. After you create a private registry, push an image to it{: external}. You can also set up an access token. By using an access token, you can more easily grant and revoke access to your Docker Hub account without requiring a password change. For more information about access tokens and Docker Hub, see Managing access tokens{: external}.

  2. Add access to your private registry in order to pull images. To add access to a private registry with the CLI, use the ibmcloud ce registry create command to create an image registry access secret. For example, the following registry create command creates registry access to a Docker Hub registry called privatedocker that is at 'https://index.docker.io/v1/' and uses your username and password.

    ibmcloud ce registry create --name privatedocker --server 'https://index.docker.io/v1/' --username <Docker_User_Name> --password <Password>
    

    {: pre}

    Example output

    Creating image registry access secret 'privatedocker'...
    OK
    

    {: screen}

  3. Create your app and reference the image in your private Docker Hub registry. For example, create the myhelloapp app to reference the docker.io/privaterepo/helloworld by using the privatedocker access information.

    ibmcloud ce app create --name myhelloapp --image docker.io/privaterepo/helloworld --registry-secret privatedocker
    

    {: pre}

    The format of the name of the image for this application is REGISTRY/NAMESPACE/REPOSITORY:TAG where REGISTRY and TAG are optional. If REGISTRY is not specified, the default is docker.io. If TAG is not specified, the default is latest. {: important}

  4. After your app deploys, you can access the app. To obtain the URL of your app, run ibmcloud ce app get --name myhelloapp --output url. When you curl the myhelloapp app, Hello World is returned.

    curl https://myhelloapp.abcdabcdhye.us-south.codeengine.appdomain.cloud
    

    {: pre}

Looking for more code examples? Check out the Samples for {{site.data.keyword.codeenginefull_notm}} GitHub repo{: external}. {: tip}