Build image from Pod Yaml like in docker-compose
Hi Everybody, I'm switching from Docker to Podman on my VPS and I'm trying to convert all docker-compose to Pod Yaml. I know that Podman is supposed to use for `podman play kube` only Yaml generated by `podman generate kube` and not user generated Yaml. But it works just fine like for example demonstrated here: https://www.redhat.com/sysadmin/compose-podman-pods I found project `Kompose` and I know that Podman 3.0 is supposed to support actual docker-compose but it's very clear to me that Pod Yaml is the right way to go. The only thing I can't reproduce in Pod Yaml is `build: .` like this: -------------------------- version: '3' services: web: build: . ... db: image: mariadb ... -------------------------- In other words this will not work: -------------------------- apiVersion: v1 kind: Pod metadata: labels: app: my-pod name: my-pod status: {} spec: restartPolicy: Always containers: - name: web build: . ... - name: db image: mariadb ... -------------------------- So the only way is to create `Containerfile`, `podman build .` and then define Yaml like this: -------------------------- apiVersion: v1 kind: Pod metadata: labels: app: my-pod name: my-pod status: {} spec: restartPolicy: Always containers: - name: web image: sha256:307e5ce57d57472b6392f5027e0aa69c1090cd312e3429afdbd950d0d1fbae15 ... - name: db image: mariadb ... -------------------------- Could you please tell me is there a way how to build image from Pod Yaml like you can do with docker-compose? Thank you. Kind regards, Bobes T.
Bobes, This is an extremely interesting use case, and not one I was familiar with. Could you share an example docker-compose file that you would like to convert to Kube YAML? I know you've made a recommendation on the Kube YAML you'd like to see, but that feels like specifying an interface without completely verifying the use case. If we could see the source/origin docker-compose YAML, that would really help the engineering team validate the design of the interface in the Kube YAML. AFAIK, there is not native Build directive in Kube, so we would need something like BuildConfig in OpenShift. There's also a new upstream project that Red Hat is sponsoring which be Kubernetes neutral (aka not OpenShift only). That might be something we could target as well, but I'll need to go chase down the project upstream. A quick google search did not turn anything up. Best Regards Scott M On Fri, Jan 29, 2021 at 3:01 PM <bobtruhla@seznam.cz> wrote:
Hi Everybody,
I'm switching from Docker to Podman on my VPS and I'm trying to convert all docker-compose to Pod Yaml.
I know that Podman is supposed to use for `podman play kube` only Yaml generated by `podman generate kube` and not user generated Yaml. But it works just fine like for example demonstrated here: https://www.redhat.com/sysadmin/compose-podman-pods
I found project `Kompose` and I know that Podman 3.0 is supposed to support actual docker-compose but it's very clear to me that Pod Yaml is the right way to go.
The only thing I can't reproduce in Pod Yaml is `build: .` like this:
-------------------------- version: '3' services: web: build: . ... db: image: mariadb ... --------------------------
In other words this will not work:
-------------------------- apiVersion: v1 kind: Pod metadata: labels: app: my-pod name: my-pod status: {} spec: restartPolicy: Always containers: - name: web build: . ... - name: db image: mariadb ... --------------------------
So the only way is to create `Containerfile`, `podman build .` and then define Yaml like this:
-------------------------- apiVersion: v1 kind: Pod metadata: labels: app: my-pod name: my-pod status: {} spec: restartPolicy: Always containers: - name: web image: sha256:307e5ce57d57472b6392f5027e0aa69c1090cd312e3429afdbd950d0d1fbae15 ... - name: db image: mariadb ... --------------------------
Could you please tell me is there a way how to build image from Pod Yaml like you can do with docker-compose?
Thank you.
Kind regards,
Bobes T. _______________________________________________ Podman mailing list -- podman@lists.podman.io To unsubscribe send an email to podman-leave@lists.podman.io
-- -- The Delicate Art of Product Management with Open Source: http://crunchtools.com/open-source-in-business-2020/ -- Scott McCarty Product Management - Containers, Red Hat Enterprise Linux & OpenShift Email: smccarty@redhat.com Phone: 312-660-3535 Cell: 330-807-1043 Web: http://crunchtools.com
Bobes, I found the upstream build project. It's called Shipwright: https://github.com/shipwright-io/build This might be a good interface to support builds on Podman. Not sure yet. Best Regards Scott M On Mon, Feb 1, 2021 at 1:05 PM Scott McCarty <smccarty@redhat.com> wrote:
Bobes, This is an extremely interesting use case, and not one I was familiar with. Could you share an example docker-compose file that you would like to convert to Kube YAML? I know you've made a recommendation on the Kube YAML you'd like to see, but that feels like specifying an interface without completely verifying the use case.
If we could see the source/origin docker-compose YAML, that would really help the engineering team validate the design of the interface in the Kube YAML. AFAIK, there is not native Build directive in Kube, so we would need something like BuildConfig in OpenShift.
There's also a new upstream project that Red Hat is sponsoring which be Kubernetes neutral (aka not OpenShift only). That might be something we could target as well, but I'll need to go chase down the project upstream. A quick google search did not turn anything up.
Best Regards Scott M
On Fri, Jan 29, 2021 at 3:01 PM <bobtruhla@seznam.cz> wrote:
Hi Everybody,
I'm switching from Docker to Podman on my VPS and I'm trying to convert all docker-compose to Pod Yaml.
I know that Podman is supposed to use for `podman play kube` only Yaml generated by `podman generate kube` and not user generated Yaml. But it works just fine like for example demonstrated here: https://www.redhat.com/sysadmin/compose-podman-pods
I found project `Kompose` and I know that Podman 3.0 is supposed to support actual docker-compose but it's very clear to me that Pod Yaml is the right way to go.
The only thing I can't reproduce in Pod Yaml is `build: .` like this:
-------------------------- version: '3' services: web: build: . ... db: image: mariadb ... --------------------------
In other words this will not work:
-------------------------- apiVersion: v1 kind: Pod metadata: labels: app: my-pod name: my-pod status: {} spec: restartPolicy: Always containers: - name: web build: . ... - name: db image: mariadb ... --------------------------
So the only way is to create `Containerfile`, `podman build .` and then define Yaml like this:
-------------------------- apiVersion: v1 kind: Pod metadata: labels: app: my-pod name: my-pod status: {} spec: restartPolicy: Always containers: - name: web image: sha256:307e5ce57d57472b6392f5027e0aa69c1090cd312e3429afdbd950d0d1fbae15 ... - name: db image: mariadb ... --------------------------
Could you please tell me is there a way how to build image from Pod Yaml like you can do with docker-compose?
Thank you.
Kind regards,
Bobes T. _______________________________________________ Podman mailing list -- podman@lists.podman.io To unsubscribe send an email to podman-leave@lists.podman.io
--
--
The Delicate Art of Product Management with Open Source: http://crunchtools.com/open-source-in-business-2020/ --
Scott McCarty Product Management - Containers, Red Hat Enterprise Linux & OpenShift Email: smccarty@redhat.com Phone: 312-660-3535 Cell: 330-807-1043 Web: http://crunchtools.com
-- -- The Delicate Art of Product Management with Open Source: http://crunchtools.com/open-source-in-business-2020/ -- Scott McCarty Product Management - Containers, Red Hat Enterprise Linux & OpenShift Email: smccarty@redhat.com Phone: 312-660-3535 Cell: 330-807-1043 Web: http://crunchtools.com
I got this one ... look for something in the coming weeks On Mon, 2021-02-01 at 13:09 -0500, Scott McCarty wrote:
Bobes, I found the upstream build project. It's called Shipwright: https://github.com/shipwright-io/build
This might be a good interface to support builds on Podman. Not sure yet.
Best Regards Scott M
On Mon, Feb 1, 2021 at 1:05 PM Scott McCarty <smccarty@redhat.com> wrote:
Bobes, This is an extremely interesting use case, and not one I was familiar with. Could you share an example docker-compose file that you would like to convert to Kube YAML? I know you've made a recommendation on the Kube YAML you'd like to see, but that feels like specifying an interface without completely verifying the use case.
If we could see the source/origin docker-compose YAML, that would really help the engineering team validate the design of the interface in the Kube YAML. AFAIK, there is not native Build directive in Kube, so we would need something like BuildConfig in OpenShift.
There's also a new upstream project that Red Hat is sponsoring which be Kubernetes neutral (aka not OpenShift only). That might be something we could target as well, but I'll need to go chase down the project upstream. A quick google search did not turn anything up.
Best Regards Scott M
On Fri, Jan 29, 2021 at 3:01 PM <bobtruhla@seznam.cz> wrote:
Hi Everybody,
I'm switching from Docker to Podman on my VPS and I'm trying to convert all docker-compose to Pod Yaml.
I know that Podman is supposed to use for `podman play kube` only Yaml generated by `podman generate kube` and not user generated Yaml. But it works just fine like for example demonstrated here: https://www.redhat.com/sysadmin/compose-podman-pods
I found project `Kompose` and I know that Podman 3.0 is supposed to support actual docker-compose but it's very clear to me that Pod Yaml is the right way to go.
The only thing I can't reproduce in Pod Yaml is `build: .` like this:
-------------------------- version: '3' services: web: build: . ... db: image: mariadb ... --------------------------
In other words this will not work:
-------------------------- apiVersion: v1 kind: Pod metadata: labels: app: my-pod name: my-pod status: {} spec: restartPolicy: Always containers: - name: web build: . ... - name: db image: mariadb ... --------------------------
So the only way is to create `Containerfile`, `podman build .` and then define Yaml like this:
-------------------------- apiVersion: v1 kind: Pod metadata: labels: app: my-pod name: my-pod status: {} spec: restartPolicy: Always containers: - name: web image: sha256:307e5ce57d57472b6392f5027e0aa69c1090cd312e3429afdbd950d0d1 fbae15 ... - name: db image: mariadb ... --------------------------
Could you please tell me is there a way how to build image from Pod Yaml like you can do with docker-compose?
Thank you.
Kind regards,
Bobes T. _______________________________________________ Podman mailing list -- podman@lists.podman.io To unsubscribe send an email to podman-leave@lists.podman.io
-- -- The Delicate Art of Product Management with Open Source: http://crunchtools.com/open-source-in-business-2020/ -- Scott McCarty Product Management - Containers, Red Hat Enterprise Linux & OpenShift Email: smccarty@redhat.com Phone: 312-660-3535 Cell: 330-807-1043 Web: http://crunchtools.com
_______________________________________________ Podman mailing list -- podman@lists.podman.io To unsubscribe send an email to podman-leave@lists.podman.io
On 2/1/21 13:39, Brent Baude wrote:
I got this one ... look for something in the coming weeks Might be something we should talk to the
https://github.com/shipwright-io/build team about.
On Mon, 2021-02-01 at 13:09 -0500, Scott McCarty wrote:
Bobes, I found the upstream build project. It's called Shipwright: https://github.com/shipwright-io/build
This might be a good interface to support builds on Podman. Not sure yet.
Best Regards Scott M
On Mon, Feb 1, 2021 at 1:05 PM Scott McCarty <smccarty@redhat.com> wrote:
Bobes, This is an extremely interesting use case, and not one I was familiar with. Could you share an example docker-compose file that you would like to convert to Kube YAML? I know you've made a recommendation on the Kube YAML you'd like to see, but that feels like specifying an interface without completely verifying the use case.
If we could see the source/origin docker-compose YAML, that would really help the engineering team validate the design of the interface in the Kube YAML. AFAIK, there is not native Build directive in Kube, so we would need something like BuildConfig in OpenShift.
There's also a new upstream project that Red Hat is sponsoring which be Kubernetes neutral (aka not OpenShift only). That might be something we could target as well, but I'll need to go chase down the project upstream. A quick google search did not turn anything up.
Best Regards Scott M
On Fri, Jan 29, 2021 at 3:01 PM <bobtruhla@seznam.cz> wrote:
Hi Everybody,
I'm switching from Docker to Podman on my VPS and I'm trying to convert all docker-compose to Pod Yaml.
I know that Podman is supposed to use for `podman play kube` only Yaml generated by `podman generate kube` and not user generated Yaml. But it works just fine like for example demonstrated here: https://www.redhat.com/sysadmin/compose-podman-pods
I found project `Kompose` and I know that Podman 3.0 is supposed to support actual docker-compose but it's very clear to me that Pod Yaml is the right way to go.
The only thing I can't reproduce in Pod Yaml is `build: .` like this:
-------------------------- version: '3' services: web: build: . ... db: image: mariadb ... --------------------------
In other words this will not work:
-------------------------- apiVersion: v1 kind: Pod metadata: labels: app: my-pod name: my-pod status: {} spec: restartPolicy: Always containers: - name: web build: . ... - name: db image: mariadb ... --------------------------
So the only way is to create `Containerfile`, `podman build .` and then define Yaml like this:
-------------------------- apiVersion: v1 kind: Pod metadata: labels: app: my-pod name: my-pod status: {} spec: restartPolicy: Always containers: - name: web image: sha256:307e5ce57d57472b6392f5027e0aa69c1090cd312e3429afdbd950d0d1 fbae15 ... - name: db image: mariadb ... --------------------------
Could you please tell me is there a way how to build image from Pod Yaml like you can do with docker-compose?
Thank you.
Kind regards,
Bobes T. _______________________________________________ Podman mailing list -- podman@lists.podman.io To unsubscribe send an email to podman-leave@lists.podman.io
-- -- The Delicate Art of Product Management with Open Source: http://crunchtools.com/open-source-in-business-2020/ -- Scott McCarty Product Management - Containers, Red Hat Enterprise Linux & OpenShift Email: smccarty@redhat.com Phone: 312-660-3535 Cell: 330-807-1043 Web: http://crunchtools.com
_______________________________________________ Podman mailing list -- podman@lists.podman.io To unsubscribe send an email to podman-leave@lists.podman.io
Podman mailing list -- podman@lists.podman.io To unsubscribe send an email to podman-leave@lists.podman.io
Hi Scott, I'm looking for the same functionality. If that's OK I'd like to answer your question.
If we could see the source/origin docker-compose YAML,
The Yaml might get messed up so you can also get it from here: https://gist.github.com/rudolfvesely/4ad6f762eafbe5417f80ff469b690c38 I intentionally made it complicated to show various options from "docker-compose". - "build: ." will use Dockerfile (in case of Podman this should be Containerfile) to build image. In other words this will run "docker build ." - "args" will define / overwrite values in "ARG" in Dockerfile/Containerfile - "dockerfile: ./foo/bar/containerfile_for_db" is used when Dockerfile has different name. In other words this will run "docker build --file=foo/bar/containerfile_for_db" $ cat ./something/api.env
NODE_ENV=test
$ cat .env
TAG=v1.5
$ cat docker-compose.yml
version: "3.9" services: webserver: # "Dockerfile" is located in the working directory and will be used to build image build: . # build arguments (used in Dockerfile) args: APP_HOME: app # environment variables environment: FLASK_ENV: development dbserver: # "Dockerfile" has different name dockerfile: ./foo/bar/containerfile_for_db # environment variables in a file env_file: - ./something/api.env redis: # variable defined in ".env" image: "webapp:${TAG}" volumes: - logvolume01:/var/log ports: - "5000:5000"
Please let me know if you have other questions. Kind regards, Rudolf Vesely
I think supporting the “build:” directive on docker-compose yaml since podman can do both build and run containers Very common use case for a large audience using docker-compose transitioning and migrating to podman to have the functionality of “docker-compose build” followed by the normal “docker-compose up” Here is an example of using “build:” in one my labs for distributing tracing using nodejs and java https://cloudnative101.dev/electives/dist-trace/activities/lab1 I think is ok if it’s not supported from kube yaml pod just from a compose, since a podspec should not have any build directives - Carlos Santana @csantanapr
On Feb 5, 2021, at 3:57 AM, Rudolf Vesely via Podman <podman@lists.podman.io> wrote:
Hi Scott,
I'm looking for the same functionality. If that's OK I'd like to answer your question.
If we could see the source/origin docker-compose YAML,
The Yaml might get messed up so you can also get it from here: https://gist.github.com/rudolfvesely/4ad6f762eafbe5417f80ff469b690c38
I intentionally made it complicated to show various options from "docker-compose".
- "build: ." will use Dockerfile (in case of Podman this should be Containerfile) to build image. In other words this will run "docker build ." - "args" will define / overwrite values in "ARG" in Dockerfile/Containerfile - "dockerfile: ./foo/bar/containerfile_for_db" is used when Dockerfile has different name. In other words this will run "docker build --file=foo/bar/containerfile_for_db"
$ cat ./something/api.env
NODE_ENV=test
$ cat .env
TAG=v1.5
$ cat docker-compose.yml
version: "3.9" services: webserver: # "Dockerfile" is located in the working directory and will be used to build image build: . # build arguments (used in Dockerfile) args: APP_HOME: app # environment variables environment: FLASK_ENV: development dbserver: # "Dockerfile" has different name dockerfile: ./foo/bar/containerfile_for_db # environment variables in a file env_file: - ./something/api.env redis: # variable defined in ".env" image: "webapp:${TAG}" volumes: - logvolume01:/var/log ports: - "5000:5000"
Please let me know if you have other questions.
Kind regards,
Rudolf Vesely _______________________________________________ Podman mailing list -- podman@lists.podman.io To unsubscribe send an email to podman-leave@lists.podman.io
participants (6)
-
bobtruhla@seznam.cz -
Brent Baude -
Carlos Santana -
Daniel Walsh -
Rudolf Vesely -
Scott McCarty