まずは下記記事を参考して
参考記事:
https://qiita.com/sugasaki/items/bc1b7cfd29e83341f467
docker pull python:3.7-alpine3.15
Sample
[zzeng@Zhens-MacBook-Pro ~/OneDrive/80_zzeng/work]$ docker pull python:3.7-alpine3.15
3.7-alpine3.15: Pulling from library/python
ab6db1bc80d0: Pull complete
104c00f00fd4: Pull complete
933a3380d086: Pull complete
8a756279a8ef: Pull complete
42a15d76ef81: Pull complete
Digest: sha256:7005581339cf80bec3af32f67b1e17ea5e0e8fc68abc5865ad362f7daf5e23f0
Status: Downloaded newer image for python:3.7-alpine3.15
docker.io/library/python:3.7-alpine3.15
[zzeng@Zhens-MacBook-Pro ~/OneDrive/80_zzeng/work]$
[zzeng@Zhens-MacBook-Pro ~/OneDrive/80_zzeng/work]$ docker image list
REPOSITORY TAG IMAGE ID CREATED SIZE
python 3.7-alpine3.15 29f91664fd0f 47 hours ago 45.6MB
python latest 930516bcf910 9 days ago 920MB
hello-world latest feb5d9fea6a5 10 months ago 13.3kB
apache/nifi latest 6ca96dc25d43 16 months ago 2.03GB
[zzeng@Zhens-MacBook-Pro ~/OneDrive/80_zzeng/work]$ docker run -it <IMAGE ID> python
Python 3.7.13 (default, Jul 20 2022, 01:42:51)
[GCC 10.3.1 20211027] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>>