The Docker image format and container runtime are now available in OpenShift / Kubernetes, which allows you import images from Docker Hub or any other external Docker registry.
OpenShift restrictions on containers
OpenShift Online being a public service puts high requirements on the security of user data. And for this particular reason, not every single container is allowed to run on the platform.
The general problem we see everyday is that containers are trying to run as root. Is that a good idea? Not really, would you let the application running directly on the OS run as root? No! You would not and the same is true with containers. Applications should run as a regular use.
OpenShift does enforce this and because not all images are built in the sane way, you may run into problems with some containers. What's going to happen in that case? As you try to create the application you will see this notice:
<code>* WARNING: Image "<something>" runs as the 'root' user which may not be permitted by your cluster administrator</code>
In such a case you would need to build (if you are the owner) or rebuild (if you just want to use someone’s image) the image to not expect to be run as root.
Deploying the containers
To deploy custom containers, you need to use the terminal as it's not yet exposed in the web UI. You will use the oc client tool with the new-app command as you usually use for deploying stuff on OpenShift (oc new-app [image]~[source code]).
<code>oc new-app centos/python-35-centos7~https://github.com/openshift/django-ex.git</code>
--> Found Docker image 59a9d28 (34 hours old) from Docker Hub for "centos/python-35-centos7"Python 3.5
----------
Platform for building and running Python 3.5 applicationsTags: builder, python, python35, rh-python35
* An image stream will be created as "python-35-centos7:latest" that will track the source image
* A source build using source code from https://github.com/openshift/django-ex.git will be created
* The resulting image will be pushed to image stream "django-ex:latest"
* Every time "python-35-centos7:latest" changes a new build will be triggered
* This image will be deployed in deployment config "django-ex"
* Port 8080/tcp will be load balanced by service "django-ex"
* Other containers can access this service through the hostname "django-ex"
--> Creating resources with label app=django-ex ...
imagestream "python-35-centos7" created
imagestream "django-ex" created
buildconfig "django-ex" created
deploymentconfig "django-ex" created
service "django-ex" created
--> Success
Build scheduled, use 'oc logs -f bc/django-ex' to track its progress.
Run 'oc status' to view your app.
Once deployed, you need to expose the service provided by the container, in this case it would be:
<code>oc expose svc django-ex</code>
And check what your URL looks like:
<code>oc status</code>
Open the URL in your browser and you will be able to view your running application.
Voilà, you just deployed Python 3.5 on CentOS 7 using a pre-built container from Docker Hub.
저자 소개
채널별 검색
오토메이션
기술, 팀, 인프라를 위한 IT 자동화 최신 동향
인공지능
고객이 어디서나 AI 워크로드를 실행할 수 있도록 지원하는 플랫폼 업데이트
오픈 하이브리드 클라우드
하이브리드 클라우드로 더욱 유연한 미래를 구축하는 방법을 알아보세요
보안
환경과 기술 전반에 걸쳐 리스크를 감소하는 방법에 대한 최신 정보
엣지 컴퓨팅
엣지에서의 운영을 단순화하는 플랫폼 업데이트
인프라
세계적으로 인정받은 기업용 Linux 플랫폼에 대한 최신 정보
애플리케이션
복잡한 애플리케이션에 대한 솔루션 더 보기
가상화
온프레미스와 클라우드 환경에서 워크로드를 유연하게 운영하기 위한 엔터프라이즈 가상화의 미래