安装docker:

Docker 服务管理

docker run -d --name gitlab-runner --restart always -v /Users/sky/dev/docker/gitlab-runner/config:/etc/gitlab-runner gitlab/gitlab-runner:latest
docker exec -it gitlab-runner gitlab-runner register
  • Pull the latest version:
docker pull gitlab/gitlab-runner:latest
  • Stop and remove the existing container:
docker stop gitlab-runner && docker rm gitlab-runner
  • 要从 Docker Hub 取得最新的稳定版 CentOS 官方映像:
sudo docker pull centos:latest
sudo docker pull centos:centos6
  • 测试centos是否可以运行成功:
sudo docker images centos
  • 要查看已下载至本地的映像:
sudo docker images centos
  • 要通过 docker 执行基本的 cat 指令:
sudo docker run centos:latest cat /etc/centos-release
sudo docker run -i -t centos7 /bin/bash

一切正常的话,你会看到一个终端提示符,然后你就可以像操作任何CentOS机器一样进行你的体验。

Run a Hello world

  • docker run runs a container.

centos:centos7 is the image you run, for example the centos operating system image. When you specify an image, Docker looks first for the image on your Docker host. If the image does not exist locally, then the image is pulled from the public image registry Docker Hub. /bin/echo is the command to run inside the new container.

docker run centos:centos7  /bin/echo 'Hello world’
  • docker ps

The docker ps command queries the Docker daemon for information about all the containers it knows about.

docker ps
  • docker logs
docker logs CONTAINERID
  • Running a web application in Docker
docker run -d -P centos:centos7 python app.py

查找docker images

https://hub.docker.com/explore/

$ docker search

更新ubuntu image

docker run -t -i ubuntu  /bin/bash
root@00ee3e6b6450:/# apt-get install -g nodejs

root@00ee3e6b6450:/# apt-get update

root@00ee3e6b6450:/# apt-get install -y nodejs npm git

root@00ee3e6b6450:/# exit
docker commit -m "apt-get node install" -a "sky"

Building an image from a Dockerfile

$ mkdir docker-sky-dev
$ cd docker-sky-dev

docker run -t -i centos:centos7  /bin/bash

// 编译docker image
docker build --rm -t  docker-sky-centos .


gitlab-ci-multi-runner unregister --url http://gitlab.xxxx.com/ci --token xxxxxxx

docker强制批量删除none的image镜像

docker ps -a | grep "Exited" | awk '{print $1 }'|xargs docker stop
docker ps -a | grep "Exited" | awk '{print $1 }'|xargs docker rm
docker images|grep none|awk '{print $3 }'|xargs docker rmi -f

install node.js

wget http://nodejs.org/dist/v6.7.0/node-v6.7.0-linux-x64.tar.gz

tar --strip-components 1 -xzvf node-v* -C /usr/local

node --version

install nvm

wget https://github.com/cnpm/nvm/archive/v0.23.0.tar.gz  -P /opt/download

tar --strip-components 1 -xzvf /opt/download/v0.23.0.tar.gz -C /opt/download

cd /opt/download

./install.sh

source ~/.nvm/nvm.sh

nvm install 8.13.0

nvm alias default 8.13.0


## install electron


yum install clang dbus-devel gtk2-devel libnotify-devel libgnome-keyring-devel \
                   xorg-x11-server-utils libcap-devel cups-devel libXtst-devel \
                   alsa-lib-devel libXrandr-devel GConf2-devel nss-devel libgtk-x11-2.0.so.0 libXss.so

npm install electron -g


## yum

> http://repository.it4i.cz/mirrors/repoforge/redhat/el6/en/x86_64/rpmforge/RPMS/rpmforge-release-0.5.3-1.el6.rf.x86_64.rpm

yum whatprovides

// 安装 example.rpm 包并在安装过程中显示正在安装的文件信息及安装进度;
rpm -ivh example.rpm 

yum groupinstall "Development Tools"
dnf groupinstall "Development Tools"

https://www.centos.org/forums/viewtopic.php?t=52129

安装 bzip2

wget http://www.bzip.org/1.0.6/bzip2-1.0.6.tar.gz
tar xf bzip2-1.0.6.tar.gz
cd bzip2-1.0.6
make
make install

yum install rpm-devel
yum install libxml2 libxslt

DockerFile

# 设置基础镜像
FROM ubuntu:latest

# 如果上个步骤已经更新软件源,这步可以忽略
RUN apt-get update

# 安装 NodeJS 和 npm
RUN apt-get install -y nodejs npm

# 将目录中的文件添加至镜像的 /srv/hello 目录中
ADD . /srv/hello

# 设置工作目录
WORKDIR /srv/hello

# 安装 Node 依赖库
RUN npm install

# 暴露 3001 端口,便于访问
EXPOSE 3001

# 设置启动时默认运行命令
CMD ["nodejs”, “/srv/hello/index.js"]

Author: sky
Reprint policy: All articles in this blog are used except for special statements CC BY 4.0 reprint polocy. If reproduced, please indicate source sky !
 Previous
Webpack 构建流程解密 Webpack 构建流程解密
通过 Webpack 工具,可以很方便完成各种框架的构建打包支持。使用 Webpack 一段事件后,各种配置也都非常熟悉, 但只停留使用节点,对内部原理极致不是非常清新,常常带着这些疑问:Webpack 启动流程是怎么样的?Webpack 插件是怎么使用的,怎么保证调用顺序?Webpack 事件机制是怎么样的?接下来我将通过从 Webpack 启动流程, 事件机制, 插件机制, 热更新等几方面深入的讲述一下构建 Webpack 内部构建流程。启动流程首先我们来看看webpack的 webpack.js...
2019-12-23 sky
Next 
React Native代码执行跟踪和调试 React Native代码执行跟踪和调试
原文 https://hubcarl.github.io/blog/2016/09/04/react-native-debug/在本地开发时, React Native 是加载本地Node服务, 可以通过npm start 启动, package.json 代码如下:"scripts&...
2019-12-23 sky