Skip to content
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

[APIv2] Create container does not initialize WorkingDir and few other things #7235

Closed
psakar opened this issue Aug 5, 2020 · 12 comments · Fixed by #7409 or #7851
Closed

[APIv2] Create container does not initialize WorkingDir and few other things #7235

psakar opened this issue Aug 5, 2020 · 12 comments · Fixed by #7409 or #7851
Assignees
Labels
kind/bug Categorizes issue or PR as related to a bug. locked - please file new issue/PR Assist humans wanting to comment on an old issue or PR with locked comments.

Comments

@psakar
Copy link
Contributor

psakar commented Aug 5, 2020

Is this a BUG REPORT or FEATURE REQUEST? (leave only one on its own line)

/kind bug

Description

Container created via REST API v2 does not start properly because working dir, environment variables and network are not set correctly. It works as expected when started using podman CLI

Steps to reproduce the issue:

  1. Assert you are able to start container via Podman CLI
podman pull docker.io/rmohr/activemq:5.15.9-alpine
podman create --interactive -p 61616:61616 --name activemq docker.io/rmohr/activemq:5.15.9-alpine
podman start activemq
sleep 10
podman logs activemq
podman inspect activemq > /tmp/test-activemq-podman-cli.txt
podman stop activemq
podman rm activemq 
  1. Try to do the same via REST API v2
podman --log-level=debug system service -t 0 tcp:localhost:8880 2>&1>/tmp/podman-rest.log &

curl -X POST -H "Content-Type: application/json" 'http://127.0.0.1:8880/containers/create?name=activemq' --data '{"name":"activemq", "Image":"docker.io/rmohr/activemq:5.15.9-alpine", "ExposedPorts": { "61616/tcp": {} }, "HostConfig": { "PortBindings": { "61616/tcp": [{ "HostPort": "" }] } } }'
curl -X POST -H "Content-Type: application/json" 'http://127.0.0.1:8880/containers/activemq/start'
sleep 10
curl --output - -H "Content-Type: application/json" "http://127.0.0.1:8880/containers/activemq/logs?stdout=true&stderr=true"
podman logs activemq
podman inspect activemq > /tmp/test-activemq-podman-rest.txt
curl -X POST -H "Content-Type: application/json" 'http://127.0.0.1:8880/containers/activemq/stop'
curl -X DELETE -H "Content-Type: application/json" 'http://127.0.0.1:8880/containers/activemq'
  1. Notice container failed to start properly in step 2 (compare log content with logs from step 1)
    Compare container details written to /tmp/test-activemq-podman-cli.txt and /tmp/test-activemq-podman-rest.txt

Describe the results you received:
Container was not started properly in step 2 via REST API v2
Container working dir is empty, some environment variables are different and network is not available in container ( network mode is empty when inspecting container)

Describe the results you expected:
Container will be started properly in step 2 via REST API v2
Container working dir, environment variables and network mode are the same as when started via CLI

Additional information you deem important (e.g. issue happens only occasionally):
I can set the working dir in create operation, possibly do the same with ENV variables as workaround. I'm not able to set network mode, no matter whether I use value bridge or slirp4netns (I can see this value when inspecting container created by CLI)

Output of podman version:

Version:      2.0.4
API Version:  1
Go Version:   go1.13.14
Git Commit:   cab27868766a3b01ac14ff46180af8644c41d1cd
Built:        Wed Aug  5 17:41:16 2020
OS/Arch:      linux/amd64

Output of podman info --debug:

host:
  arch: amd64
  buildahVersion: 1.15.0
  cgroupVersion: v2
  conmon:
    package: conmon-2.0.19-1.fc31.x86_64
    path: /usr/bin/conmon
    version: 'conmon version 2.0.19, commit: ed806cf10f2791e13a8cb3ca3552cd1e9fa996e4'
  cpus: 8
  distribution:
    distribution: fedora
    version: "31"
  eventLogger: file
  hostname: localhost
  idMappings:
    gidmap:
    - container_id: 0
      host_id: 21528
      size: 1
    - container_id: 1
      host_id: 100000
      size: 65536
    uidmap:
    - container_id: 0
      host_id: 21528
      size: 1
    - container_id: 1
      host_id: 100000
      size: 65536
  kernel: 5.7.9-100.fc31.x86_64
  linkmode: dynamic
  memFree: 2640662528
  memTotal: 16381521920
  ociRuntime:
    name: crun
    package: crun-0.14.1-1.fc31.x86_64
    path: /bin/crun
    version: |-
      crun version 0.14.1
      commit: 598ea5e192ca12d4f6378217d3ab1415efeddefa
      spec: 1.0.0
      +SYSTEMD +SELINUX +APPARMOR +CAP +SECCOMP +EBPF +YAJL
  os: linux
  remoteSocket:
    path: /run/user/21528/podman/podman.sock
  rootless: true
  slirp4netns:
    executable: /bin/slirp4netns
    package: slirp4netns-1.1.4-1.fc31.x86_64
    version: |-
      slirp4netns version 1.1.4
      commit: b66ffa8e262507e37fca689822d23430f3357fe8
      libslirp: 4.1.0
      SLIRP_CONFIG_VERSION_MAX: 1
  swapFree: 8245211136
  swapTotal: 8252289024
  uptime: 10h 18m 13.34s (Approximately 0.42 days)
registries:
  search:
  - registry.fedoraproject.org
  - registry.access.redhat.com
  - registry.centos.org
  - docker.io
store:
  configFile: /home/psakar/.config/containers/storage.conf
  containerStore:
    number: 3
    paused: 0
    running: 0
    stopped: 3
  graphDriverName: vfs
  graphOptions: {}
  graphRoot: /home/psakar/.local/share/containers/storage
  graphStatus: {}
  imageStore:
    number: 65
  runRoot: /run/user/21528/run
  volumePath: /home/psakar/.local/share/containers/storage/volumes
version:
  APIVersion: 1
  Built: 1596642076
  BuiltTime: Wed Aug  5 17:41:16 2020
  GitCommit: cab27868766a3b01ac14ff46180af8644c41d1cd
  GoVersion: go1.13.14
  OsArch: linux/amd64
  Version: 2.0.4

Package info (e.g. output of rpm -q podman or apt list podman):

NA (podman build from sources from tag v2.0.4)

Additional environment details (AWS, VirtualBox, physical, etc.):

@openshift-ci-robot openshift-ci-robot added the kind/bug Categorizes issue or PR as related to a bug. label Aug 5, 2020
@psakar
Copy link
Contributor Author

psakar commented Aug 5, 2020

@mheon As promissed new issue created. I've retested with v 2.0.4 to be sure it is not fixed in the meantime

@mheon
Copy link
Member

mheon commented Aug 5, 2020

Entrypoint should be fixed on master, but the rest is likely still an issue.

@psakar
Copy link
Contributor Author

psakar commented Aug 5, 2020

Adding diff from inspect.

Most notable differences - ENV.PATH, WorkingDir, NetworkMode, ShmSize

--- /tmp/test-activemq-podman-rest.txt	2020-08-05 19:06:15.635558095 +0200
+++ /tmp/test-activemq-podman-cli.txt	2020-08-05 18:29:25.560238133 +0200
@@ -1,7 +1,7 @@
 [
     {
-        "Id": "9ef861a86df05e2464f5a4a1cc9057a22ead8aa35fd1cb91b7ba135d63dee538",
-        "Created": "2020-08-05T19:06:04.864012434+02:00",
+        "Id": "12876a4a0771bcf42e3b1d6efdc6c985eb9ac26667620b0a09d1995cdeb508ca",
+        "Created": "2020-08-05T18:29:14.736059527+02:00",
         "Path": "/bin/sh",
         "Args": [
             "-c",
@@ -9,17 +9,18 @@
         ],
         "State": {
             "OciVersion": "1.0.2-dev",
-            "Status": "stopped",
-            "Running": false,
+            "Status": "running",
+            "Running": true,
             "Paused": false,
             "Restarting": false,
             "OOMKilled": false,
             "Dead": false,
-            "Pid": 0,
-            "ExitCode": 127,
+            "Pid": 123507,
+            "ConmonPid": 123504,
+            "ExitCode": 0,
             "Error": "",
-            "StartedAt": "2020-08-05T19:06:05.265530466+02:00",
-            "FinishedAt": "2020-08-05T19:06:05.277526524+02:00",
+            "StartedAt": "2020-08-05T18:29:15.276274506+02:00",
+            "FinishedAt": "0001-01-01T00:00:00Z",
             "Healthcheck": {
                 "Status": "",
                 "FailingStreak": 0,
@@ -30,37 +31,22 @@
         "ImageName": "docker.io/rmohr/activemq:5.15.9-alpine",
         "Rootfs": "",
         "Pod": "",
-        "ResolvConfPath": "/run/user/21528/run/vfs-containers/9ef861a86df05e2464f5a4a1cc9057a22ead8aa35fd1cb91b7ba135d63dee538/userdata/resolv.conf",
-        "HostnamePath": "/run/user/21528/run/vfs-containers/9ef861a86df05e2464f5a4a1cc9057a22ead8aa35fd1cb91b7ba135d63dee538/userdata/hostname",
-        "HostsPath": "/run/user/21528/run/vfs-containers/9ef861a86df05e2464f5a4a1cc9057a22ead8aa35fd1cb91b7ba135d63dee538/userdata/hosts",
-        "StaticDir": "/home/psakar/.local/share/containers/storage/vfs-containers/9ef861a86df05e2464f5a4a1cc9057a22ead8aa35fd1cb91b7ba135d63dee538/userdata",
-        "OCIConfigPath": "/home/psakar/.local/share/containers/storage/vfs-containers/9ef861a86df05e2464f5a4a1cc9057a22ead8aa35fd1cb91b7ba135d63dee538/userdata/config.json",
+        "ResolvConfPath": "/run/user/21528/run/vfs-containers/12876a4a0771bcf42e3b1d6efdc6c985eb9ac26667620b0a09d1995cdeb508ca/userdata/resolv.conf",
+        "HostnamePath": "/run/user/21528/run/vfs-containers/12876a4a0771bcf42e3b1d6efdc6c985eb9ac26667620b0a09d1995cdeb508ca/userdata/hostname",
+        "HostsPath": "/run/user/21528/run/vfs-containers/12876a4a0771bcf42e3b1d6efdc6c985eb9ac26667620b0a09d1995cdeb508ca/userdata/hosts",
+        "StaticDir": "/home/psakar/.local/share/containers/storage/vfs-containers/12876a4a0771bcf42e3b1d6efdc6c985eb9ac26667620b0a09d1995cdeb508ca/userdata",
+        "OCIConfigPath": "/home/psakar/.local/share/containers/storage/vfs-containers/12876a4a0771bcf42e3b1d6efdc6c985eb9ac26667620b0a09d1995cdeb508ca/userdata/config.json",
         "OCIRuntime": "crun",
-        "LogPath": "/home/psakar/.local/share/containers/storage/vfs-containers/9ef861a86df05e2464f5a4a1cc9057a22ead8aa35fd1cb91b7ba135d63dee538/userdata/ctr.log",
+        "LogPath": "/home/psakar/.local/share/containers/storage/vfs-containers/12876a4a0771bcf42e3b1d6efdc6c985eb9ac26667620b0a09d1995cdeb508ca/userdata/ctr.log",
         "LogTag": "",
-        "ConmonPidFile": "/run/user/21528/run/vfs-containers/9ef861a86df05e2464f5a4a1cc9057a22ead8aa35fd1cb91b7ba135d63dee538/userdata/conmon.pid",
+        "ConmonPidFile": "/run/user/21528/run/vfs-containers/12876a4a0771bcf42e3b1d6efdc6c985eb9ac26667620b0a09d1995cdeb508ca/userdata/conmon.pid",
         "Name": "activemq",
         "RestartCount": 0,
         "Driver": "vfs",
-        "MountLabel": "system_u:object_r:container_file_t:s0:c132,c620",
-        "ProcessLabel": "system_u:system_r:container_t:s0:c132,c620",
+        "MountLabel": "system_u:object_r:container_file_t:s0:c624,c763",
+        "ProcessLabel": "system_u:system_r:container_t:s0:c624,c763",
         "AppArmorProfile": "",
-        "EffectiveCaps": [
-            "CAP_AUDIT_WRITE",
-            "CAP_CHOWN",
-            "CAP_DAC_OVERRIDE",
-            "CAP_FOWNER",
-            "CAP_FSETID",
-            "CAP_KILL",
-            "CAP_MKNOD",
-            "CAP_NET_BIND_SERVICE",
-            "CAP_NET_RAW",
-            "CAP_SETFCAP",
-            "CAP_SETGID",
-            "CAP_SETPCAP",
-            "CAP_SETUID",
-            "CAP_SYS_CHROOT"
-        ],
+        "EffectiveCaps": null,
         "BoundingCaps": [
             "CAP_AUDIT_WRITE",
             "CAP_CHOWN",
@@ -106,16 +92,16 @@
                     }
                 ]
             },
-            "SandboxKey": "/run/user/21528/netns/cni-af591f9a-4d2e-6911-1def-10f131733e24"
+            "SandboxKey": "/run/user/21528/netns/cni-ceedfe04-7989-9829-49b1-abaf63db80d7"
         },
         "ExitCommand": [
-            "/bin/sh",
+            "/usr/bin/podman",
             "--root",
             "/home/psakar/.local/share/containers/storage",
             "--runroot",
             "/run/user/21528/run",
             "--log-level",
-            "debug",
+            "error",
             "--cgroup-manager",
             "systemd",
             "--tmpdir",
@@ -128,40 +114,40 @@
             "file",
             "container",
             "cleanup",
-            "9ef861a86df05e2464f5a4a1cc9057a22ead8aa35fd1cb91b7ba135d63dee538"
+            "12876a4a0771bcf42e3b1d6efdc6c985eb9ac26667620b0a09d1995cdeb508ca"
         ],
         "Namespace": "",
         "IsInfra": false,
         "Config": {
-            "Hostname": "9ef861a86df0",
+            "Hostname": "12876a4a0771",
             "Domainname": "",
-            "User": "",
+            "User": "activemq",
             "AttachStdin": false,
             "AttachStdout": false,
             "AttachStderr": false,
             "Tty": false,
-            "OpenStdin": false,
+            "OpenStdin": true,
             "StdinOnce": false,
             "Env": [
-                "PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin",
+                "PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/lib/jvm/java-1.8-openjdk/jre/bin:/usr/lib/jvm/java-1.8-openjdk/bin",
                 "TERM=xterm",
-                "HOSTNAME=9ef861a86df0",
+                "container=podman",
                 "JAVA_ALPINE_VERSION=8.212.04-r0",
                 "ACTIVEMQ_HOME=/opt/activemq",
                 "ACTIVEMQ_UI=8161",
                 "ACTIVEMQ_WS=61614",
                 "ACTIVEMQ_STOMP=61613",
                 "SHA512_VAL=35cae4258e38e47f9f81e785f547afc457fc331d2177bfc2391277ce24123be1196f10c670b61e30b43b7ab0db0628f3ff33f08660f235b7796d59ba922d444f",
                 "ACTIVEMQ_VERSION=5.15.9",
                 "ACTIVEMQ_MQTT=1883",
-                "container=libpod"
+                "HOSTNAME=12876a4a0771",
             ],
             "Cmd": [
                 "/bin/sh",
@@ -170,30 +156,41 @@
             ],
             "Image": "docker.io/rmohr/activemq:5.15.9-alpine",
             "Volumes": null,
-            "WorkingDir": "/",
+            "WorkingDir": "/opt/activemq",
             "Entrypoint": "",
             "OnBuild": null,
             "Labels": null,
             "Annotations": {
                 "io.container.manager": "libpod",
-                "io.kubernetes.cri-o.Created": "2020-08-05T19:06:04.864012434+02:00",
+                "io.kubernetes.cri-o.Created": "2020-08-05T18:29:14.736059527+02:00",
+                "io.kubernetes.cri-o.TTY": "false",
                 "io.podman.annotations.autoremove": "FALSE",
                 "io.podman.annotations.init": "FALSE",
                 "io.podman.annotations.privileged": "FALSE",
                 "io.podman.annotations.publish-all": "FALSE",
                 "org.opencontainers.image.stopSignal": "15"
             },
-            "StopSignal": 15
+            "StopSignal": 15,
+            "CreateCommand": [
+                "podman",
+                "create",
+                "--interactive",
+                "-p",
+                "61616:61616",
+                "--name",
+                "activemq",
+                "docker.io/rmohr/activemq:5.15.9-alpine"
+            ]
         },
         "HostConfig": {
             "Binds": [],
             "CgroupMode": "private",
             "ContainerIDFile": "",
             "LogConfig": {
-                "Type": "",
+                "Type": "k8s-file",
                 "Config": null
             },
-            "NetworkMode": "",
+            "NetworkMode": "slirp4netns",
             "PortBindings": {
                 "61616/tcp": [
                     {
@@ -229,7 +226,7 @@
             "Tmpfs": {},
             "UTSMode": "private",
             "UsernsMode": "",
-            "ShmSize": 0,
+            "ShmSize": 65536000,
             "Runtime": "oci",
             "ConsoleSize": [
                 0,
@@ -259,19 +256,8 @@
             "MemorySwap": 0,
             "MemorySwappiness": 0,
             "OomKillDisable": false,
-            "PidsLimit": 0,
-            "Ulimits": [
-                {
-                    "Name": "RLIMIT_NOFILE",
-                    "Soft": 524288,
-                    "Hard": 524288
-                },
-                {
-                    "Name": "RLIMIT_NPROC",
-                    "Soft": 62323,
-                    "Hard": 62323
-                }
-            ],
+            "PidsLimit": 2048,
+            "Ulimits": [],
             "CpuCount": 0,
             "CpuPercent": 0,
             "IOMaximumIOps": 0,

@ghost
Copy link

ghost commented Aug 21, 2020

hello,
I have a difference in Path element.
myimage have entrypoint java -jar /tmp/app.jar and when creating container using cli:
podman run myimage --param1 --param2, I got:

[
  {
    "Id": "1469c2370e51076a15d29f14d79d24e2ff1182e0ebe837a75e4dde36051b2720",
    "Created": "2020-08-21T08:00:51.110336872+02:00",
    "Path": "java",
    "Args": [
      "-jar",
      "/tmp/app.jar",
      "--param1 --param2"
    ],

When creating using API:
curl --unix-socket /run/podman/podman.sock http://localhost/v1.40/containers/create -X POST -H "Content-Type: application/json" --data '{"Image":"myimage", "Cmd": ["--param1", "--param2"]}', it overrides entrypoint's Path with first element of "command", resulting in failure to start:

[
  {
    "Id": "62a035f5d4ee8389d465e628a9ea48ca349d11fc2d1f81bc54529a05102ce1a5",
    "Created": "2020-08-21T08:23:36.811274277+02:00",
    "Path": "--param1",
    "Args": [
      "--param2"
    ],

@zhangguanzhang
Copy link
Collaborator

hello,
I have a difference in Path element.
myimage have entrypoint java -jar /tmp/app.jar and when creating container using cli:
podman run myimage --param1 --param2, I got:

[
  {
    "Id": "1469c2370e51076a15d29f14d79d24e2ff1182e0ebe837a75e4dde36051b2720",
    "Created": "2020-08-21T08:00:51.110336872+02:00",
    "Path": "java",
    "Args": [
      "-jar",
      "/tmp/app.jar",
      "--param1 --param2"
    ],

When creating using API:
curl --unix-socket /run/podman/podman.sock http://localhost/v1.40/containers/create -X POST -H "Content-Type: application/json" --data '{"Image":"myimage", "Cmd": ["--param1", "--param2"]}', it overrides entrypoint's Path with first element of "command", resulting in failure to start:

[
  {
    "Id": "62a035f5d4ee8389d465e628a9ea48ca349d11fc2d1f81bc54529a05102ce1a5",
    "Created": "2020-08-21T08:23:36.811274277+02:00",
    "Path": "--param1",
    "Args": [
      "--param2"
    ],

which the version did you used?

@ghost
Copy link

ghost commented Aug 21, 2020

host:
  arch: amd64
  buildahVersion: 1.15.0
  cgroupVersion: v1
  conmon:
    package: conmon-2.0.20-1.el8.x86_64
    path: /usr/bin/conmon
    version: 'conmon version 2.0.20, commit: 064c4ad2d7293c326be702ec8fcae8a3741aa6ee'
  cpus: 2
  distribution:
    distribution: '"centos"'
    version: "8"
  eventLogger: file
  hostname: template-kvm-centos-8.efinity.local
  idMappings:
    gidmap:
    - container_id: 0
      host_id: 513
      size: 1
    uidmap:
    - container_id: 0
      host_id: 1004
      size: 1
  kernel: 4.18.0-193.14.2.el8_2.x86_64
  linkmode: dynamic
  memFree: 986423296
  memTotal: 1915490304
  ociRuntime:
    name: runc
    package: runc-1.0.0-145.rc91.git24a3cf8.el8.x86_64
    path: /usr/bin/runc
    version: 'runc version spec: 1.0.2-dev'
  os: linux
  remoteSocket:
    path: /run/user/1004/podman/podman.sock
  rootless: true
  slirp4netns:
    executable: /usr/bin/slirp4netns
    package: slirp4netns-1.1.4-1.el8.x86_64
    version: |-
      slirp4netns version 1.1.4
      commit: b66ffa8e262507e37fca689822d23430f3357fe8
      libslirp: 4.3.1
      SLIRP_CONFIG_VERSION_MAX: 3
  swapFree: 1002434560
  swapTotal: 1002434560
  uptime: 45.85s
registries:
  docker.arti.efinity.local:
    Blocked: false
    Insecure: false
    Location: docker.arti.efinity.local
    MirrorByDigestOnly: false
    Mirrors: null
    Prefix: docker.arti.efinity.local
  docker.io:
    Blocked: false
    Insecure: false
    Location: docker.io
    MirrorByDigestOnly: false
    Mirrors:
    - Insecure: false
      Location: docker.arti-7.efinity.local
    Prefix: docker.io
  registry.access.redhat.com:
    Blocked: false
    Insecure: false
    Location: registry.access.redhat.com
    MirrorByDigestOnly: false
    Mirrors:
    - Insecure: false
      Location: docker.arti-7.efinity.local
    Prefix: registry.access.redhat.com
  search:
  - registry.access.redhat.com
  - docker.io
store:
  configFile: /home/USERS/atalarek/.config/containers/storage.conf
  containerStore:
    number: 0
    paused: 0
    running: 0
    stopped: 0
  graphDriverName: vfs
  graphOptions: {}
  graphRoot: /home/USERS/atalarek/.local/share/containers/storage
  graphStatus: {}
  imageStore:
    number: 0
  runRoot: /run/user/1004/containers
  volumePath: /home/USERS/atalarek/.local/share/containers/storage/volumes
version:
  APIVersion: 1
  Built: 0
  BuiltTime: Thu Jan  1 01:00:00 1970
  GitCommit: ""
  GoVersion: go1.13.4
  OsArch: linux/amd64
  Version: 2.0.4

@psakar
Copy link
Contributor Author

psakar commented Aug 27, 2020

@zhangguanzhang @mheon I've retested with podman version 2.0.5 using procedure described at the beginning of the issue and the issue is not fixed. Can you please reopen ?

@mheon
Copy link
Member

mheon commented Aug 27, 2020

The fix for this did not make it into Podman 2.0.5, from the look of things.

@mheon
Copy link
Member

mheon commented Aug 27, 2020

I suspect it will be in Podman 2.1.0 - we should start cutting release candidates for that sometime next week.

@psakar
Copy link
Contributor Author

psakar commented Sep 26, 2020

@mheon I've tested podman 2.1.0 and the issue is not fixed.

Environment of container created and started via podman CLI is

        "Env": [
            "PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/lib/jvm/java-1.8-openjdk/jre/bin:/usr/lib/jvm/java-1.8-openjdk/bin",
            "TERM=xterm",
            "container=podman",
            "containers=podman",
            "ACTIVEMQ_TCP=61616",
            "ACTIVEMQ_STOMP=61613",
            "ACTIVEMQ_MQTT=1883",
            "JAVA_HOME=/usr/lib/jvm/java-1.8-openjdk/jre",
            "ACTIVEMQ_VERSION=5.15.9",
            "ACTIVEMQ_AMQP=5672",
            "ACTIVEMQ_WS=61614",
            "ACTIVEMQ=apache-activemq-5.15.9",
            "JAVA_VERSION=8u212",
            "ACTIVEMQ_HOME=/opt/activemq",
            "ACTIVEMQ_UI=8161",
            "LANG=C.UTF-8",
            "SHA512_VAL=35cae4258e38e47f9f81e785f547afc457fc331d2177bfc2391277ce24123be1196f10c670b61e30b43b7ab0db0628f3ff33f08660f235b7796d59ba922d444f",
            "JAVA_ALPINE_VERSION=8.212.04-r0",
            "HOSTNAME=b5354926848f",
            "HOME=/opt/activemq"
        ],

working dir is

"WorkingDir": "/opt/activemq"

Environment and working dir of container created and started via podman REST API is evidently different

        "Env": [
            "PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin",
            "TERM=xterm",
            "HOSTNAME=22ca6632a040",
            "HOME=/root",
            "container=libpod"
        ],

"WorkingDir": "/",

Looks like the ENV commands from the dockerfile are "ignored" during container start - https://github.com/rmohr/docker-activemq/blob/master/5.15.9-alpine/Dockerfile

@rhatdan
Copy link
Member

rhatdan commented Sep 29, 2020

Could you open a separate PR for this, also could you confirm that this happens with podman-remote as well?

@rhatdan
Copy link
Member

rhatdan commented Sep 29, 2020

My quick test worked for podman-remote

cat /tmp/Containerfile 
from alpine
env foo="bar"

podman build -t test /tmp/
STEP 1: FROM alpine
STEP 2: env foo="bar"
STEP 3: COMMIT test
--> 4ef13359820
4ef133598207f231915be000a1c2c1a58fa1de0a36f2d33e9106f9722af0ae58

# podman run test printenv
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
TERM=xterm
container=podman
containers=podman
foo=bar
HOSTNAME=c0d6deb6e205
HOME=/root

# podman-remote  run test printenv
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
TERM=xterm
container=podman
containers=podman
foo=bar
HOSTNAME=56b8a8b4df8a
HOME=/root

@zhangguanzhang zhangguanzhang self-assigned this Sep 30, 2020
@github-actions github-actions bot added the locked - please file new issue/PR Assist humans wanting to comment on an old issue or PR with locked comments. label Sep 22, 2023
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 22, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
kind/bug Categorizes issue or PR as related to a bug. locked - please file new issue/PR Assist humans wanting to comment on an old issue or PR with locked comments.
Projects
None yet
5 participants