$ docker build -t weifeng/python-test .
Sending build context to Docker daemon 4.096 kB
Sending build context to Docker daemon
Step 0 : FROM python
---> e40a58408002
Step 1 : COPY . /src
---> f6bbef432539
Removing intermediate container 5cf730296296
Step 2 : CMD python /src/test.py
---> Running in 38dd55515457
---> 7cdd41de0576
Removing intermediate container 38dd55515457
Successfully built 7cdd41de0576
$ docker run weifeng/python-test
test....
generate random is
$ docker login (dockerlogin--username=yourhubusername--password=yourpassword--email=youremail@company.com)
Username: oite
Password:
Email: [email protected]
WARNING: login credentials saved in /home/weifeng/.docker/config.json
Login Succeeded
$ docker push oite/python-test
The push refers to a repository [oite/python-test] (len: 1)
...........
$ docker rmi -f 7cdd41de0576
Untagged: weifeng/python-test:latest
Deleted: 7cdd41de0576a96a7f30d3419b3e75c593c0f599310b76cd397dcdc0556229ea
Deleted: f6bbef43253911533099283cd65ad4346f3f8a4de837ff2c0d1d91262634bf05
参考:
docker official
Using Docker to Run Python
push your image