Skip to main content

Set docker proxy

· 2 min read
  1. create/edit user docker configuration:
sudo vim /etc/docker/daemon.json
  1. set up proxy
{
"proxies": {
"http-proxy": "http://proxy.example.com:80",
"https-proxy": "https://proxy.example.com:443",
"no-proxy": "*.test.example.com,.example.org"
}
}
  • This is a full example of the allowed configuration options on Linux:
{
"allow-nondistributable-artifacts": [],
"api-cors-header": "",
"authorization-plugins": [],
"bip": "",
"bridge": "",
"cgroup-parent": "",
"containerd": "/run/containerd/containerd.sock",
"containerd-namespace": "docker",
"containerd-plugin-namespace": "docker-plugins",
"data-root": "",
"debug": true,
"default-address-pools": [{
"base": "172.30.0.0/16",
"size": 24
},
{
"base": "172.31.0.0/16",
"size": 24
}
],
"default-cgroupns-mode": "private",
"default-gateway": "",
"default-gateway-v6": "",
"default-network-opts": {},
"default-runtime": "runc",
"default-shm-size": "64M",
"default-ulimits": {
"nofile": {
"Hard": 64000,
"Name": "nofile",
"Soft": 64000
}
},
"dns": [],
"dns-opts": [],
"dns-search": [],
"exec-opts": [],
"exec-root": "",
"experimental": false,
"features": {},
"fixed-cidr": "",
"fixed-cidr-v6": "",
"group": "",
"hosts": [],
"proxies": {
"http-proxy": "http://proxy.example.com:80",
"https-proxy": "https://proxy.example.com:443",
"no-proxy": "*.test.example.com,.example.org",
},
"icc": false,
"init": false,
"init-path": "/usr/libexec/docker-init",
"insecure-registries": [],
"ip": "0.0.0.0",
"ip-forward": false,
"ip-masq": false,
"iptables": false,
"ip6tables": false,
"ipv6": false,
"labels": [],
"live-restore": true,
"log-driver": "json-file",
"log-level": "",
"log-opts": {
"cache-disabled": "false",
"cache-max-file": "5",
"cache-max-size": "20m",
"cache-compress": "true",
"env": "os,customer",
"labels": "somelabel",
"max-file": "5",
"max-size": "10m"
},
"max-concurrent-downloads": 3,
"max-concurrent-uploads": 5,
"max-download-attempts": 5,
"mtu": 0,
"no-new-privileges": false,
"node-generic-resources": [
"NVIDIA-GPU=UUID1",
"NVIDIA-GPU=UUID2"
],
"oom-score-adjust": 0,
"pidfile": "",
"raw-logs": false,
"registry-mirrors": [],
"runtimes": {
"cc-runtime": {
"path": "/usr/bin/cc-runtime"
},
"custom": {
"path": "/usr/local/bin/my-runc-replacement",
"runtimeArgs": [
"--debug"
]
}
},
"seccomp-profile": "",
"selinux-enabled": false,
"shutdown-timeout": 15,
"storage-driver": "",
"storage-opts": [],
"swarm-default-advertise-addr": "",
"tls": true,
"tlscacert": "",
"tlscert": "",
"tlskey": "",
"tlsverify": true,
"userland-proxy": false,
"userland-proxy-path": "/usr/libexec/docker-proxy",
"userns-remap": ""
}

No module named 'charset_normalizer.md__mypyc'

· One min read
  • report message
Traceback (most recent call last):
File "requests\compat.py", line 11, in <module>
ModuleNotFoundError: No module named 'chardet'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "minarca_client\main.py", line 15, in <module>
from minarca_client.core import (
File "PyInstaller\loader\pyimod03_importers.py", line 495, in exec_module
File "minarca_client\core\__init__.py", line 23, in <module>
import requests
File "PyInstaller\loader\pyimod03_importers.py", line 495, in exec_module
File "requests\__init__.py", line 45, in <module>
File "PyInstaller\loader\pyimod03_importers.py", line 495, in exec_module
File "requests\exceptions.py", line 9, in <module>
File "PyInstaller\loader\pyimod03_importers.py", line 495, in exec_module
File "requests\compat.py", line 13, in <module>
File "PyInstaller\loader\pyimod03_importers.py", line 495, in exec_module
File "charset_normalizer\__init__.py", line 24, in <module>
File "PyInstaller\loader\pyimod03_importers.py", line 495, in exec_module
File "charset_normalizer\api.py", line 5, in <module>
File "PyInstaller\loader\pyimod03_importers.py", line 495, in exec_module
File "charset_normalizer\cd.py", line 9, in <module>
ModuleNotFoundError: No module named 'charset_normalizer.md__mypyc'
  • resolution
pyinstaller --hiddenimport charset_normalizer.md__mypyc 

coredump related settings

· One min read

1. coredump limits

  • for this login time
ulimits -c unlimited
  • for the permanent time
vim /etc/security/limits.conf

* soft core unlimited
* hard core unlimited

2. coredump file path

sudo sysctl -w kernel.core_pattern="|/tmp/core_dump_example.py %e"

man core for the details about % part like %e in coredump file name

3. generating coredump

kill -SIGSEGV ${PID}

generate coredump for docker container

· One min read
  • use --cap-add=SYS_PTRACE flag when running the container
docker run --cap-add=SYS_PTRACE ...
  • add it to a docker-compose file
version: '3'
services:
your-service:
image: your-image
cap_add:
- SYS_PTRACE

yum error with SyntaxError: invalid syntax

· One min read

yum error message:

[root@31f24739f206 /]# yum File "/usr/bin/yum", line 30 except KeyboardInterrupt, e: ^ SyntaxError: invalid syntax

  • change default python from python3 to python2
alternatives --install /usr/bin/python python /usr/bin/python2 0

Docker: Enable Non-Root User Access

· One min read

Enable Non-Root User Access

  1. Enter the command below to create the docker group on the system.
sudo groupadd -f docker
  1. Type the following usermod command to add the active user to the docker group.
sudo usermod -aG docker $USER
  1. Apply the group changes to the current terminal session by typing:
newgrp docker
  1. Check if the docker group is in the list of user groups.
groups

Why openldap doesn't sync from master

· 2 min read

config

#
# See slapd.conf(5) for details on configuration options.
# This file should NOT be world readable.
#

...

# #开启同步
# overlay syncprov
# #contextCSN 当修改20条时 或者10分钟
# syncprov-checkpoint 20 10
# #session 每次同步数据最大量
# syncprov-sessionlog 1000

slave logs

Feb 17 10:08:20 host-10-213-115-95 bdl[pid=3007515,tid=0xeef7da40]: do_syncrep1: rid=000 starting refresh (sending cookie=rid=000,csn=20230216083743.943082Z#000000#002#000000) Feb 17 10:08:20 host-10-213-115-95 bdl[pid=3007515,tid=0xeef7da40]: do_syncrep2: rid=000 got search entry without Sync State control (dc=sinopec,dc=com) Feb 17 10:08:20 host-10-213-115-95 bdl[pid=3007515,tid=0xeef7da40]: do_syncrepl: rid=000 rc -1 retrying (9 retries left) Feb 17 10:09:20 host-10-213-115-95 bdl[pid=3007515,tid=0xeef7da40]: do_syncrep1: rid=000 starting refresh (sending cookie=rid=000,csn=20230216083743.943082Z#000000#002#000000) Feb 17 10:09:20 host-10-213-115-95 bdl[pid=3007515,tid=0xeef7da40]: do_syncrep2: rid=000 got search entry without Sync State control (dc=sinopec,dc=com) Feb 17 10:09:20 host-10-213-115-95 bdl[pid=3007515,tid=0xeef7da40]: do_syncrepl: rid=000 rc -1 retrying (8 retries left) Feb 17 10:10:20 host-10-213-115-95 bdl[pid=3007515,tid=0xeef7da40]: do_syncrep1: rid=000 starting refresh (sending cookie=rid=000,csn=20230216083743.943082Z#000000#002#000000) Feb 17 10:10:20 host-10-213-115-95 bdl[pid=3007515,tid=0xeef7da40]: do_syncrep2: rid=000 got search entry without Sync State control (dc=sinopec,dc=com) Feb 17 10:10:20 host-10-213-115-95 bdl[pid=3007515,tid=0xeef7da40]: do_syncrepl: rid=000 rc -1 retrying (7 retries left) Feb 17 10:11:20 host-10-213-115-95 bdl[pid=3007515,tid=0xeef7da40]: do_syncrep1: rid=000 starting refresh (sending cookie=rid=000,csn=20230216083743.943082Z#000000#002#000000) Feb 17 10:11:20 host-10-213-115-95 bdl[pid=3007515,tid=0xeef7da40]: do_syncrep2: rid=000 got search entry without Sync State control (dc=sinopec,dc=com) Feb 17 10:11:20 host-10-213-115-95 bdl[pid=3007515,tid=0xeef7da40]: do_syncrepl: rid=000 rc -1 retrying (6 retries left) Feb 17 10:12:20 host-10-213-115-95 bdl[pid=3007515,tid=0xeef7da40]: do_syncrep1: rid=000 starting refresh (sending cookie=rid=000,csn=20230216083743.943082Z#000000#002#000000) Feb 17 10:12:20 host-10-213-115-95 bdl[pid=3007515,tid=0xeef7da40]: do_syncrep2: rid=000 got search entry without Sync State control (dc=sinopec,dc=com) Feb 17 10:12:20 host-10-213-115-95 bdl[pid=3007515,tid=0xeef7da40]: do_syncrepl: rid=000 rc -1 retrying (5 retries left)

Solutions

uncomment overlay syncprov on master

#开启同步
overlay syncprov
#contextCSN 当修改20条时 或者10分钟
syncprov-checkpoint 20 10
#session 每次同步数据最大量
syncprov-sessionlog 1000