docker-commmon-error
1. docker registiry pull Error http: server gave HTTP response to HTTPS client
1 | docker pull 192.168.0.10:5000/centos |
解决办法: 在daemon.json里面添加insecure-registries
1 | # Mac ~/.docker/daemon.json |
重启docker
1 | docker pull 192.168.0.10:5000/centos |
解决办法: 在daemon.json里面添加insecure-registries
1 | # Mac ~/.docker/daemon.json |
重启docker
自己搭建的docker registry, docker pull 报错
1 | filesystem layer verification failed for digest sha256:xxx |
应该是镜像的某一层layer校验不通过,参考:
https://github.com/distribution/distribution/issues/2168
删除镜像,重新上传一次镜像
进入到registry容器里,打开delete配置
1 | docker container exec -it registry sh |
重启容器
1 | docker container restart registry |
这里以 zcloud/calico:v3.8.2 举例
1 | # 查看镜像列表 |
重启docker container restart registry
** 如果此时重新push同名镜像, 要等几分钟才才能pull到 **
every progrommer had his “Hello World !” in mind, as list bellow, mine
bash
1 |
|
java
1 | public class HelloWorld { |
C
1 |
|
python
1 | #!/usr/bin/python |
Welcome to Hexo! This is your very first post. Check documentation for more info. If you get any problems when using Hexo, you can find the answer in troubleshooting or you can ask me on GitHub.
1 | $ hexo new "My New Post" |
More info: Writing
1 | $ hexo server |
More info: Server
1 | $ hexo generate |
More info: Generating
1 | $ hexo deploy |
More info: Deployment
刚刚接触golang, 准备用golang gin mongodb写一个CRUD小Demo,把遇到的知识点记录下来, 给自己以后参考
1 | # module/post.go |
1 | # 方法一 |
使用Linux安装软件,有时候需要设置环境变量,有的文档建议设置在.bashrc里, 有的建议.bash_profile里
一般都能生效,那么区别是什么呢?
.bash_profile is executed for login shells, while .bashrc is executed for interactive non-login shells.
bash_profile: 登录试shell执行
bashrc: 非登录式shell执行
登录试: 当你敲入用户名和密码登录的终端, 或通过ssh登录机器. .bash_profile会被调用
非登录: 当你已经登录了机器,在桌面环境打开终端, 或者在终端里面调用了/bin/bash, 此时.bashrc会被调用
比如,你希望第一次登录机器的时候,想看到机器的负载, 那么把uptime命令写到.bash_profile里面就可以了.
如果写到.bashrc里面, 你每次打开终端, 都会看到机器负载。
当你设置PATH环境变量的时候, 把变量写到.bashrc
在.bash_profile里面加载.bashrc
1 | if [ -f ~/.bashrc ]; then |
在Linux上执行history命令默认不现实命令执行时间,对于问题排查不是很友好.
通过设置,可以在history命令前面加上命令执行时间
bash
1 | HISTTIMEFORMAT=%Y-%m-%d %H:%M:%S |
zsh
1 | HIST_STAMPS="%Y-%m-%d %H:%M:%S" |
加载配置
1 | # bash |
1 | history |
配置docker registry 加速docker
1 | sudo vim /etc/docker/daemon.json |
1 |
|
1 | docker run ubuntu:14.04 # 如果本地没有这个image, 会从镜像仓库拉取并启动 |
1 | 输入exit 或者ctrl+d 都会退出实例 |
1 | docker [container] exec -it $containerId /bin/bash # 新启动一个bash |
新建一个目录,创建 Dockerfile
docker build -t 镜像名 .
docker run -p4000:80 镜像名
docker tag 镜像名 用户名/repository:tag
docker login # 输入用户名不带邮箱后缀
docker push 用户名/repository:tag
Centos : Centos7 64位
docker-ce: Docker-ce-17
1.卸载本地原有docker
1 | sudo yum remove docker-common docker-selinux docker-engine |
2.安装docker依赖软件和yum源
1 | sudo yum install yum-utils |
3.启动docker
1 | sudo systemctl start docker |
4.验证docker
1 | sudo docker run hello-world |
5.添加运行docker账号
docker的daemno会启动一个socket,只有root和docker组用户可以访问, 普通账号无法访问
所以需要把普通用户添加到docker组才可以访问
1 | sudo groupadd docker |
6.设置开启启动
1 | sudo systemctl enable docker |
pyenv : 管理多个Python版本, 是从rbevn(管理多个ruby版本)改造来的
virtualenv: 管理工作空间的python环境, 可以让每个app的python环境相互隔离, 相当于给每个app都复制一份python
pyenv 已经集成了 virtualenv, 所以不需要单独安装virtualenv了.
安装pyenv比较简单
1 | # 下载到本地: |
使用
1 | pyenv install --list #查看可安装python版本 |
卸载 pyenv
1 | rm -rf $(pyenv root) |
1 | pyenv virtualenv 2.7.12 VENV27 # 将会在pyenv的version目录下新建一个VENV27的python环境 |
国内访问pip默认源超时严重, 建议设置阿里或豆瓣的pip源
1 | vim ~/.pip/pip.conf |
工作中很少使用root用户,存在使用个人用户,切换到work账户的场景
比如我的个人账户是mihenkii, 要切换的目标账户是work
1 |
|