[root@jd ~]# docker pull python:3.6
3.6: Pulling from library/python
16ea0e8c8879: Downloading 
50024b0106d5: Download complete 
ff95660c6937: Download complete 
9c7d0e5c0bc2: Download complete 
29c4fb388fdf: Download complete 
49a8841b38a3: Download complete 
c4a74b0ecce5: Download complete 
3e19e7d95a0c: Download complete 
c6c6b4054fe6: Download complete 
3.6: Pulling from library/python
16ea0e8c8879: Pull complete 
50024b0106d5: Pull complete 
ff95660c6937: Pull complete 
9c7d0e5c0bc2: Pull complete 
29c4fb388fdf: Pull complete 
49a8841b38a3: Pull complete 
c4a74b0ecce5: Pull complete 
3e19e7d95a0c: Pull complete 
c6c6b4054fe6: Pull complete 
Digest: sha256:47e547af7ffcc2f5d1e5c76a96f4122943c4631d10bb3a0375e870fd95799107
Status: Downloaded newer image for python:3.6
docker.io/library/python:3.6
[root@jd~]# docker images
REPOSITORY                 TAG                 IMAGE ID            CREATED             SIZE
python                     3.6                 5bf410ee7bb2        11 days ago         913MB
docker                     latest              52f7c6fb16b9        2 weeks ago         216MB
hello-world                latest              fce289e99eb9        11 months ago       1.84kB
# docker run -it python /bin/bash
Unable to find image 'python:latest' locally
latest: Pulling from library/python
16ea0e8c8879: Already exists 
50024b0106d5: Already exists 
ff95660c6937: Already exists 
9c7d0e5c0bc2: Already exists 
29c4fb388fdf: Already exists 
8659dae93050: Pull complete 
d4b57a0e98ff: Pull complete 
9d187245c5fc: Pull complete 
cd75e768c3f7: Pull complete 
Digest: sha256:cea522e86d1a42e0bf339e9b615a3d76f2258916ee16dc562ff9182ef15ece05
Status: Downloaded newer image for python:latest
root@940af3535fb0:/# python
Python 3.8.0 (default, Nov 23 2019, 05:36:56) 
[GCC 8.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.

>>> print("hello docker:")
hello docker:
>>> 
# Ctrl+d 退出当前交互模式
root@940af3535fb0:/# exit 
[root@jd ~]# 
# 退出时如果想继续运行:按顺序按【ctrl+p】【ctrl+q】
# 如果不想继续运行:按【ctrl+d】或输入exit
# 另:关闭后重启请输入:docker restart 【CONTAINER ID或NAMES】

 

Logo

CSDN联合极客时间,共同打造面向开发者的精品内容学习社区,助力成长!

更多推荐