Keep bloging


English Diary

I didn’t sleep last night. I was modifing the appearances of this blog. I put it a two column theme with a sidebar on left. Now it consists of three sections: It has a Home section where this entry is written. It has a About page which has two short sections on it “About me” and “About this site”. Finally I have the Projects page and I put many of my projects with links and short intros on it. I let the sidebar on left in dark, and let the main content on right in light. Then I put a logo of my photo on top of sidebar. Following that it’s the title of this blog. And then, it has a menu which has three links to three sections which I mentioned above. After that, It has several icons which was linked to my other webservices pages. Finally I put an archive list which has posts collapsed by month then collapsed by year. The right part is almost the theme ‘Twenty Fifteen’ as is. I only put an extra entry date and labels of tags under the titles.

There are many benefits for writing blog. The first of all you must take things of you writting seriously. So it would help you improving on that considerably. The videos blogs are more profitable than text-only blogs. Because the broadcasting of contents you produced would remain most cognition of yourself from audiences, which texts cannot have. So the people like Gu-A-Mo, Luo-Ji-Si-Wei, Papi-Jiang, including Zealer became famous more easier.

And there is another thing we must face. People like the contents of amusement more. That things do not need they pay much ‘cost’ which including energy spending, mental work or physical work. That things has much more audiences. The people as I mentioned above, Gu-A-Mo, Luo-Ji-Si-Wei, Papi-Jiang, Zealer, do produce that things.

Did this entry provoke your further thought? Feel free to leave a comment below.

Docker 基本使用


Coder Life

Docker 信息查看

Docker 列出镜像 images

Docker 列出运行中容器 containers

Docker 列出所有容器 containers

Docker 运行镜像(并创建容器)

options 查看 docker run --help

如果不指定容器名称,会生成随机的名称,可用 docker ps -l 查看。

一个容器对应一个虚拟的环境,所以新手要注意不要反复用 docker run 命令,而用以下的启动/停止容器命令。

Docker 启动/停止容器

Docker 查看容器内存/CPU占用

Ctrl-C 退出即可

Docker 挂载用户权限问题

Mac OS X 下 Docker 运行 mysql 容器时挂载 volumes 时权限问题

为例:

用户在文件系统中是以整型 id 来区分。所以同一个用户名在不同的环境中可能 id 不同。

查看用户 id 可以通过 cat /etc/passwd

然后在容器创建时执行命令 usermod -u 1000 mysql 即可。1000 应改为你挂载的目录的 owner id

命令可以加到 docker run [options] image command] 语句中执行。

也可以加到 Dockerfile 中,如本例中

php-apache:

Docker ssh 进入容器 shell?

从 host 进入容器不需要 ssh, 用以下命令:

其中的 sh 可以替换成容器中有的 shell, 如 bash, zsh 等

如果想能够从外网直接 ssh 进容器(不推荐, 因为你可以 ssh 到宿主机器再用上面的命令进入容器)

可以映射一个特定的端口到容器的 ssh端口(默认为22),然后从外网 ssh 到宿主 ip:映射端口

Docker 映射端口

docker run [options] container 时添加 option: -p xxxx:xx 左边的是 host, 右边的是容器。

如:

即可从宿主 ip:8080 访问到容器内的 nginx 服务器。

使用 fig

看到很多小朋友会把 docker run 的命令抄下来,以便将来需要重新 docker run。其实大可不必如此。使用 fig 就能很好的解决问题。

将会单独再写一篇文章讲 fig 的基本使用。

The First Step is the Hardest Part of Any Journey


English Diary

I fancy myself to be a “Doer”. No, I am a “Doer” and I am going to be a better “Doer” that means I have to make things happen, instead of stopping at the “thoughts” point. I have kept a Chinese diary everyday for 2 years. The idea of writing English diaries first came out at the end of last year, and I did write it per day in the first week of this year.

I am not going to set a maybe achievable goal of writing an English diary a day. Because I’m a little busy these days and I am not going to beat myself up if I could not write it out some day.

I did not keep good hours in recent weeks. Maybe it’s the reason I feel some disturbed just like yesterday. Even So I have accomplished proper advance on my project. Then I cheer myself up by watching a movie named “Alice Through the Looking Glass” after dinner.

This entry is only the first step in to longterm English journey. Now I have a book to read, good evening.