docker、jupyter、portus和gitlab的一些使用记录
最近太忙事情一多怕忘了赶紧把花时间比较多的坑写下,有点水。。。
docker使用过程的一些问题以及解决方法
jupyter的docker镜像有一些包没有,需要再获取。那docker build 时,如何使用代理去联网获取软件包?
docker build –build-arg https_proxy=http://ip:port –build-arg http_proxy=http://ip:port –network=host -t reghost/namespace/datascience-notebook:dev .
通过build时候的参数–build-arg设置代理,并使用host模式(–network=host)(这条不知是否必须,但我加上才行)即可使用代理上网,host模式会占用主机的端口,要注意。不过build的时候占用问题不大。
docker的几种网络模式的原理和对比要详细阅读此篇understanding-docker-networking-drivers-use-cases
host如果在/etc/hosts有配置,可以用volumns加载这个文件- /etc/hosts:/etc/hosts:ro
portus
可以docker login但却无法push,日志中显示scope不合法?
可能是在管理页面中配置docker registry时候,把端口号也敲上去了。。(不要加:5000,要和某处配置的域名保持一致)
详细见此issue
在docker push的时候,需要先login(不要加端口号5000)再push(之前以为反正docker tag已经有registry地址了,所以以为不用登陆…忘记还有个认证的过程…),否则会被拒绝
jupyter
归类不太准确。。。
python中读取IQ数据库,要使用sqlanydb,并且需要安装sql anywhere,见此issue,否则会报错,InterfaceError: (‘Could not load dbcapi. Tried: None,dbcapi.dll,libdbcapi_r.so,libdbcapi_r.dylib’, 0),当然了要装在镜像里。。。
gitlab
gitlab进入environment菜单后报错:
ActiveRecord::SubclassNotFound (The single-table inheritance mechanism failed to locate the subclass: 'JenkinsService'. This error is raised because the column 'type' is reserved for storing the class in case of inheritance. Please rename this column if you didn't intend it to be used for storing the inheritance class or overwrite Service.inheritance_column to use another column for that information.):
app/models/project.rb:931:in `find_service'
app/models/project.rb:907:in `block in find_or_initialize_services'
app/models/project.rb:900:in `map'
app/models/project.rb:900:in `find_or_initialize_services'
app/models/project.rb:920:in `find_or_initialize_service'
app/services/prometheus/adapter_service.rb:24:in `service_prometheus_adapter'
app/services/prometheus/adapter_service.rb:16:in `prometheus_adapter'
app/models/environment.rb:160:in `prometheus_adapter'
app/models/environment.rb:148:in `has_metrics?'
app/serializers/environment_entity.rb:12:in `block in <class:EnvironmentEntity>'
app/serializers/base_serializer.rb:14:in `represent'
app/serializers/concerns/with_pagination.rb:19:in `represent'
app/serializers/environment_serializer.rb:21:in `block in represent'
app/serializers/environment_serializer.rb:18:in `map'
app/serializers/environment_serializer.rb:18:in `represent'
app/controllers/projects/environments_controller.rb:25:in `block (2 levels) in index'
app/controllers/projects/environments_controller.rb:15:in `index'
可能的原因:从ee降级到ce后,某些服务不可用,需要删除.见gitlab文档里面的方法:
$ sudo gitlab-rails runner "Service.where(type: ['JenkinsService', 'JenkinsDeprecatedService']).delete_all"
根据错误日志中提到的Service添加进入命令中删掉即可,如:
root@c7f33f2b53e1:/# history
1 gitlab-rails runner "Service.where(type: ['GithubService']).delete_all"
2 exit
3 gitlab-rails runner "Service.where(type: ['JenkinsService']).delete_all"
4 gitlab-rails runner "Service.where(type: ['JenkinsDeprecatedService']).delete_all"
5 exit