Docker – (15) 修改已建立的container restart policy

之前建立的container忘了下restart=always,導致每次重開機都必須重啟container = =" ,好在找到指令可以即時補救,趕緊寫下來記錄一下~XD

首先可以檢查container設定

$ docker inspect [Container ID]
or 
$ docker inspect [Container Name]

可以看到container並無設定restart policy

docker_inspect_before

然後來下神奇指令docker update

$ docker update --restart=always [Container ID]
or 
$ docker update --restart=always [Container Name]

成功!restart policy已被修改!

docker_inspect_after

Linux – (7) Use Ubuntu to be NFS client

OS: Ubuntu 14.04

To install nfs-common first

$ apt-get install nfs-common

After that, we can mount nfs server

$ mount -t nfs 192.0.0.1:/nfs_folder /home/jennifer/fs

$ mount -t nfs [nfs server ip]:/[nfs server folder] [folder on host]

Also, we can create docker data volume (data volume name = my_nfs)

$ docker volume create –driver local \
–opt type=nfs \
–opt o=nfsvers=3,addr=192.0.0.1,rw \
–opt device=:/nfs_folder \
my_nfs

Use data volume while creating docker container

$ docker run -d –net=host –restart=always -v my_nfs:/tmp:ro nginx:1.13.3-alpine

Python (37) – pip 一堆坑

☁ 連線被拒絕

Looking in indexes: http://192.168.0.1:8081/repository/pypi-group/simple
Retrying (Retry(total=1, connect=None, read=None, redirect=None, 
status=None)) after connection broken by 'NewConnectionError('
<pip._vendor.urllib3.connection.HTTPConnection object at 0x7fb2f4e55f28>: 
Failed to establish a new connection: [Errno 111] 連線被拒絕',)': 
/repository/pypi-group/simple/pip/
設定index-url
pip install Pillow --index-url=https://pypi.python.org/simple/

☁ root tmp空間不足

Could not install packages due to an EnvironmentError: [Errno 28] 裝置上已無多餘空間
在Jennifer(非root用戶)的位置建立一個root_tmp資料夾,再指向tmpdir為此資料夾
mkdir root_tmp
export TMPDIR=/home/jennifer/root_tmp

(若又跳坑,會再繼續更新)