I'm trying to do something a bit unorthodox, but i...
# general
h
I'm trying to do something a bit unorthodox, but it had me poking around my docker image that I have copied a pex into with
docker exec -it <my container> bash
but I don't see the pex binary show up in my
ls
calls. Should I be able to or is there some obfuscated things happening on the
COPY
step?
1
h
h
I'm not sure it is. That seems to affect
ps
behavior. I'm confused why I don't see anything when I do
ls
but I can happily put a path in
ENTRYPOINT
and it runs my pex happily.
h
Oh shoot yeah you're totally right that they are not related. My bad!
h
The context here is that I'd like to ship out a pex but not need to have to install a python interpreter on the system that was going to use this tool. So I was going to put the pex in a docker container and run that and then mount the pex binary to a volume on the host so that it's easily callable (for other reasons). So a pretty abstract use case that maybe there are more appropriate ways to do this. I doubt pyoxidizer will work out of the box since I remember reading there were a variety of things you can't do from the blog post written about it.
But it led me to this oddity so now I'm here 🤷
e
Have you tried
docker inspect <image>
? That should reveal an entry point and you should be able to work backwards from there.
For example, from a random image on my machine:
Copy code
$ docker inspect 67ec76d9f73b | jq '.[] | .Config'
{
  "Hostname": "",
  "Domainname": "",
  "User": "",
  "AttachStdin": false,
  "AttachStdout": false,
  "AttachStderr": false,
  "Tty": false,
  "OpenStdin": false,
  "StdinOnce": false,
  "Env": [
    "PATH=/usr/local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin",
    "LANG=C.UTF-8",
    "GPG_KEY=E3FF2839C048B25C084DEBE9B26995E310250568",
    "PYTHON_VERSION=3.8.12",
    "PYTHON_PIP_VERSION=21.2.4",
    "PYTHON_SETUPTOOLS_VERSION=57.5.0",
    "PYTHON_GET_PIP_URL=<https://github.com/pypa/get-pip/raw/3cb8888cc2869620f57d5d2da64da38f516078c7/public/get-pip.py>",
    "PYTHON_GET_PIP_SHA256=c518250e91a70d7b20cceb15272209a4ded2a0c263ae5776f129e0d9b5674309"
  ],
  "Cmd": [
    "python3"
  ],
  "Image": "sha256:525b7bd065f75bf886e56e4662057daddd43ba6955a85cf3540a82e86baffc69",
  "Volumes": null,
  "WorkingDir": "",
  "Entrypoint": null,
  "OnBuild": null,
  "Labels": null
}
I could use that
PATH
to find the
python3
Cmd
for example.
h
I think I know what happened. Will confirm in a second.
Yup confirmed
When I did my volume mount, that overwrote what was in the container's directory.
b
@high-yak-85899 is this ?
h
Yeah, this was a behavior of how docker mounts volumes and not anything related to Pants.