Docker-container


Ax Docker container usage

Run

$ docker run -it ubuntu /bin/bash
  • -i: interaction
  • -t: Terminal
  • -b: backplatform run
  • ubuntu: ubuntu image
  • /bin/bash:shell path

PS:exit command quit interaction terminal

Show

$ docker ps -a

ON/OFF

$ docker start id        # start container
$ docker stop id        # stop container
$ docker restart id        # restart container

Enter into

  • docker attach ——> exit stop container
  • docker exec
$ docker attach id
$ docker exec -it id /bin/bash

Bx Expert and Import

Expert

$ docker export id > ubuntu.tar

Import

$ cat docker/ubuntu.tar | docker import - test/ubuntu:v1
$ docker import http://example.com/exampleimage.tgz example/imagerepo

Cx Delete container

$ docker rm -f id

all

$ docker container prune

Dx Open Web application

$ docker pull training/webapp
$ docker run -d -P training/webapp python app.py

Port

$ docker run -d -p 5000:5000 training/webapp python app.py

Show Port

$ docker port id or name

文章作者: Enomothem
版权声明: 本博客所有文章除特别声明外,均采用 CC BY 4.0 许可协议。转载请注明来源 Enomothem !
  目录