上課筆記
  • 20190227
  • 20190227
  • 20190306
  • 20190306
  • 20190313
  • 20190320
  • 20190327
  • 20190327
  • 20190327
  • 20190417
  • 20190424
  • 20190501
  • 20190508
  • 20190515
  • 20190529
  • 20190605
  • 20190917
  • 20190917
  • 20190924
  • 20191001
  • 20191001
  • 20191008
  • 20191008
  • 20191015
  • 20191015
  • 20191022
  • 20191022
  • 20191029
  • 20191029
  • 20191105
  • 20191105
  • 20191119
  • 20191119
  • 20191203
  • 20191203
  • 20191210
  • 20191217
  • 20191217
  • 20191224
  • 20191224
Powered by GitBook
On this page

Was this helpful?

20190917

docker

Previous20190917Next20190924

Last updated 5 years ago

Was this helpful?

上禮拜筆記:

# docker run -it -d chusiang/takaojs1607 /bin/sh -c "while true; do echo "hi"; sleep 1; done"

​準備兩台終端機

# cd /
# mkdir /mydata
# echo "hello world" > hi.txt
# cat hi.txt
# docker run -it -v /mydata/data chusiang/takaojs1607 /bin/bash
# cd /
# cd data
#/bin/bash -c "while true; do echo "hi"; sleep 3 ; done"
# docker exec -it [容器名稱] bash
# docker run -it --name [容器名稱] --rm chusiang/takaojs1607 /bin/bash
# docker ps -a
# docker start [容器名稱]
# docker attach [容器名稱]
暫時離開容器:ctrl+p+q
# apt-get update
# apt-get install iputils-ping
如果上兩段程式有出現bug,使用:
# apt-get install --fix-missing

# apt install net-tools
# docker pull httpd
# docker images
將root路徑切換到mydata下執行:
# echo "this is a index webpage" > index.html
# echo "hi" > hi.htm
# docker run -itd --name mywebserver -p 8080:80 -v /mydata:/usr/local/apache2/htdocs httpd

https://blog.51cto.com/12098022/2437854