Tag Archives: docker

[Solved] com.alibaba.druid.pool.DruidDataSource – create connecti

A service deployed in the server docker reported the following error when connecting to the database:

I have searched a lot of information on the Internet, but I can’t solve it by trying various ways,
ERROR com.alibaba.druid.pool.DruidDataSource - create connection SQLException, url: jdbc:mysql://10.10.20.16:3306/acs?&useUnicode=true&characterEncoding=UTF-8&zeroDateTimeBehavior=convertToNull&allowMultiQueries=true&serverTimezone=Asia/Kolkata, errorCode 0, state 08S01
com.mysql.cj.jdbc.exceptions.CommunicationsException: Communications link failure

The last packet sent successfully to the server was 0 milliseconds ago. The driver has not received any packets from the server.

The specific error information is as follows:

ERROR com.alibaba.druid.pool.DruidDataSource – create connection SQLException, url: jdbc:mysql ://10.10.20.16:3306/acs?& amp; useUnicode=true& characterEncoding=UTF-8& zeroDateTimeBehavior=convertToNull& allowMultiQueries=true& serverTimezone=Asia/Kolkata, errorCode 0, state 08S01
com.mysql.cj.jdbc.exceptions.CommunicationsException: Communications link failure

The last packet sent successfully to the server was 0 milliseconds ago. The driver has not received any packets from the server.

Cause of error:

It may be due to the different versions of JDK. This error message is probably caused by the SSL protocol of MySQL

solution: I tried to remove SSLv3 from java.security in jdk-8 on my local machine and restart the service, but I still couldn’t solve it
finally, add this to the MySQL connection string in the service configuration; Usessl = false, that is, disable SSL, problem solved

Docker run Error: container_linux.go:235: starting container process caused “process_linux.go:258: appl

Error message:
container_ linux.go:235: starting container process caused “process_ linux.go:258: applying cgroup configuration for process caused “Cannot set property TasksAccounting, or unknown property.””
/usr/bin/docker-current: Error response from daemon: oci runtime error: container_ linux.go:235: starting container process caused “process_ linux.go:258: applying cgroup configuration for process caused “Cannot set property TasksAccounting, or unknown prop
After the system is rebooted, the docker cannot be started. After the docker is reloaded, the startup container will report an error, as shown above

reason:

The docker version is not compatible with the operating system version. Upgrade the docker version
I use Yum to install docker. By default, I can only pull to a lower version, so I downloaded RPM docker from the Internet.

The solution to the crash loop back off error of coredns in k8s deployment

The solution to the crash loop back off error of coredns in k8s deployment

Problem description

Before doing the project, we need to use k8s to build a cluster. I’m a novice Xiaobai, and I’m going to do it step by step according to the online building steps (refer to the link website for the deployment process)
when I check the status of each pod in the cluster, I find that coredns has not been started successfully, and has been in the crashloopback off state, falling into the dead cycle of non-stop error restart

[root@k8s-master a1zMC2]# kubectl get pods -n kube-system
NAME                                 READY   STATUS             RESTARTS   AGE
coredns-bccdc95cf-9wd9n              0/1     CrashLoopBackOff   19         19h
coredns-bccdc95cf-qsf9f              0/1     CrashLoopBackOff   19         19h
etcd-k8s-master                      1/1     Running            3          19h
kube-apiserver-k8s-master            1/1     Running            3          19h
kube-controller-manager-k8s-master   1/1     Running            11         19h
kube-flannel-ds-amd64-sgqsm          1/1     Running            1          16h
kube-flannel-ds-amd64-swqhf          1/1     Running            1          16h
kube-flannel-ds-amd64-tnbmc          1/1     Running            1          16h
kube-proxy-259l8                     1/1     Running            0          16h
kube-proxy-qcnpt                     1/1     Running            0          16h
kube-proxy-rp7qx                     1/1     Running            3          19h
kube-scheduler-k8s-master            1/1     Running            11         19h

Solutions

Check the log file of coredns. The content is as follows

[root@k8s-master a1zMC2]# kubectl logs -f coredns-bccdc95cf-9wd9n -n kube-system
E0512 01:59:03.825489       1 reflector.go:134] github.com/coredns/coredns/plugin/kubernetes/controller.go:317: Failed to list *v1.Endpoints: Get https://10.96.0.1:443/api/v1/endpoints?limit=500&resourceVersion=0: dial tcp 10.96.0.1:443: connect: no route to host
E0512 01:59:03.825489       1 reflector.go:134] github.com/coredns/coredns/plugin/kubernetes/controller.go:317: Failed to list *v1.Endpoints: Get https://10.96.0.1:443/api/v1/endpoints?limit=500&resourceVersion=0: dial tcp 10.96.0.1:443: connect: no route to host
log: exiting because of error: log: cannot create log: open /tmp/coredns.coredns-bccdc95cf-9wd9n.unknownuser.log.ERROR.20210512-015903.1: no such file or directory

再通过kubectl describe pod coredns-bccdc95cf-9wd9n -n kube-system命令查看详情

Events:
  Type     Reason            Age                  From                 Message
  ----     ------            ----                 ----                 -------
  Warning  FailedScheduling  16h (x697 over 17h)  default-scheduler    0/1 nodes are available: 1 node(s) had taints that the pod didn't tolerate.
  Warning  Unhealthy         15h (x5 over 15h)    kubelet, k8s-master  Readiness probe failed: Get http://10.244.0.2:8080/health: net/http: request canceled while waiting for connection (Client.Timeout exceeded while awaiting headers)
  Warning  Unhealthy         15h (x5 over 15h)    kubelet, k8s-master  Liveness probe failed: Get http://10.244.0.2:8080/health: net/http: request canceled while waiting for connection (Client.Timeout exceeded while awaiting headers)

I feel that there should be a problem connecting with the host, so I enter cat/etc/resolv. Conf to view the configuration file. It is found that the nameserver column is not the address of the host master.

With a try attitude, modify it to the IP address of the master node, and then restart docker and kubenet

[root@k8s-master a1zMC2]# systemctl stop kubelet
[root@k8s-master a1zMC2]# systemctl stop docker
[root@k8s-master a1zMC2]# iptables --flush
[root@k8s-master a1zMC2]# iptables -tnat --flush
[root@k8s-master a1zMC2]# systemctl start kubelet
[root@k8s-master a1zMC2]# systemctl start docker

Check the status and find that all pods can work normally!

[root@k8s-master a1zMC2]# kubectl get pods -n kube-system
NAME                                 READY   STATUS    RESTARTS   AGE
coredns-bccdc95cf-9wd9n              1/1     Running   21         20h
coredns-bccdc95cf-qsf9f              1/1     Running   21         20h
etcd-k8s-master                      1/1     Running   4          19h
kube-apiserver-k8s-master            1/1     Running   4          19h
kube-controller-manager-k8s-master   1/1     Running   12         19h
kube-flannel-ds-amd64-sgqsm          1/1     Running   1          17h
kube-flannel-ds-amd64-swqhf          1/1     Running   1          17h
kube-flannel-ds-amd64-tnbmc          1/1     Running   2          17h
kube-proxy-259l8                     1/1     Running   0          17h
kube-proxy-qcnpt                     1/1     Running   0          17h
kube-proxy-rp7qx                     1/1     Running   4          20h
kube-scheduler-k8s-master            1/1     Running   12         19h

Because I haven’t learned the content of cloud computing, there are some mistakes in the blog. Please correct them in the comments area.

Docker Startup Error: standard_init_linux.go:211: exec user process caused “no such file or directory”

As shown in the question, start the Docker container according to the image built by yourself, exit directly, and check the error message in the container log without any other information. Internet search this problem, found that many people have encountered, the solution is also different, finally found an article. Inspired, my project is a Java project that builds a service running in the background with the ENTRYPOINT command starting the script docker-entrypoint.sh. My Docker-entrypoint. sh is edited under Windows, and the natural FileFormat is DOS. Here, it needs to be modified to Unix, and the modification method is also very simple. There is no need to operate under Linux.

After the modification is completed, the image can be built again. If the new image is started, no error will be reported, which is usually difficult to detect. I hereby record it, hoping to help someone who has encountered this mistake.

[environment] docker: error response from daemon: OCI runtime

Background

When the compiled image is exported and loaded into another computer, the error is as follows:

//import mirror
docker import example.tar

//run the docker
docker run -it example:v20210119 /bin/bash

//error:
docker: Error response from daemon: OCI runtime create failed: container_linux.go:348: 
starting container process caused "exec: \"/bin/bash\": stat /bin/bash: no such file or directory": unknown.

For the description of this problem, there are probably two kinds of factional explanations on the Internet under Google

Left wing school

There is no/bin/bash in production, try/bin/sh, the result is still the problem

Right wing

Compatibility between Linux and docker. Then uninstall the old version and install the latest one.

The solution of the left faction is very easy to verify. After repeated verification, the problem is still unsolved. It is commonly known as the left faction.

The solution of the right faction is a bit difficult to verify, but intuition tells me that it should not be such a problem

Sure enough, I saw the right answer. After a careful look, a short description and a quick verification, the problem was solved.

this error occurs when docker runs. It is caused by different ways of saving the image. If the image is imported by using import, it should be noted that import can import the image package saved by save and the container package saved by export. However, if the image package saved by save is imported, there is no error. But this error occurs when run runs

    1. solutions
docker load < buildroot_v20210119.tar

docker.errors.DockerException: Error while fetching server API version: (‘Connection aborted.‘, File

Problem description

ocker.errors.DockerException: Error while fetching server API version: (‘Connection aborted.’, FileNotFoundError(2, ‘No such file or directory’))

Causes

The reason is that docker did not start

terms of settlement

Open docker:

systemctl start docker

Look at docker process

ps -ef | grep docker

Final execution

docker-compose up -d

The drone settings page is not trusted

The drone settings page is not trusted

In the tutorial of building the drone cicd system, check trusted in the main part of settings. The normal page is like this

If you don’t have a trusted page, like this

It means that the user who logs in to drone is not an administrator, so you can’t see the option of trusted.

Solution

Check if there is drone in the docker running parameter of drone_ USER_ Create , as shown in the figure below

docker run \
  --volume=/opt/bin/drone/data:/data \
  --env=DRONE_GIT_ALWAYS_AUTH=true \
  --env=DRONE_GIT_USERNAME=xxx \
  --env=DRONE_GIT_PASSWORD=xxx \
  --env=DRONE_GOGS=true \
  --env=DRONE_GOGS_SKIP_VERIFY=false \
  --env=DRONE_GOGS_SERVER=http://xxx \
  --env=DRONE_PROVIDER=gogs \
  --env=DRONE_RPC_SECRET=xxx \
  --env=DRONE_USER_CREATE=username:yourUsername,admin:true \
  --env=DRONE_SERVER_PROTO=http \
  --publish=xxx:80 \
  --publish=xxx:443 \
  --restart=always \
  --detach=true \
  --name=drone \
  -h drone \
  drone/drone:1

--env=DRONE_ USER_ CREATE= username:yourUsername , admin:true this line is very important. After that, you can log in to drone with your user name and become an administrator. If you don’t add it, you won’t see the trusted button.

At that time, the -- env in my line was written as - env which resulted in that the parameters in this line did not take effect and that I did not run drone as an administrator, so I could not see the option of trusted.

Others: how to restart drone after it has been run?

docker rm -f drone # Delete the original image
# Run the above docker run to build a new image and run it

Docker mysql8 modify password

Docker mysql8 modify password

Set skip password login

docker exec -it mysql /bin/sh
# Note: The configuration file for editing is docker.cnf
vi /etc/mysql/conf.d/docker.cnf
exit

Restart MySQL container

docker restart mysql

Restart MySQL container

The old version of the command is invalid:
update user set password = password (‘a123456 ‘), where user =’root'</ s>
correct:

UPDATE mysql.user SET authentication_string='' WHERE user='root' and host='localhost';
-- Change the password for use without expiration
ALTER USER 'root'@'%' IDENTIFIED BY 'password' PASSWORD EXPIRE NEVER; 
flush privileges;

Error handling

ERROR 2059 (HY000): Authentication plugin ‘caching_ sha2_ password’ cannot be loaded: /usr/lib64/mysql/plugin/caching_ sha2_ password.so: cannot open shared object file: No such file or directory

Maybe the password is not set and will never expire. Maybe the database client version under Linux is too low. I tried to connect to mysql8 of docker in server B on server a, but the connection was successful by using DataGrid in windows.

Creating users and authorizations

create user  'nacos'@'%' identified by '123';
grant all on mid_nacos.* to 'nacos'@'localhost' ;
flush privileges;

Here, all the permissions of the table are granted, and all the items that can be authorized are explained and referenced https://www.cnblogs.com/yinzhengjie/p/10263692.html

Solve the error of operation create user failed for ‘user’ @ ‘%

It may be that the user already exists, you can delete and recreate it to
check whether the user exists: select user from user
delete: drop user 'user' @ '%

Solving com.mysql.cj.exceptions.unabletoconnectexception: public key retrieval is not allowed

Add & amp; after the connection information; allowPublicKeyRetrieval=true

[extremely simple and effective] installing docker under centos6. X

1. Upgrade Linux kernel

    rpm –import https://www.elrepo.org/RPM-GPG-KEY-elrepo.org

 

    rpm -Uvh http://www.elrepo.org/elrepo-release-6-8.el6.elrepo.noarch.rpm     

 

    yum –enablerepo=elrepo-kernel install kernel-lt -y

2. Modify default startup order

   vim /etc/ grub.conf

Restart the server

shutdown -r now

3. Disable SELinux

4. Offline installation of docker with static binary files

reference resources https://docs.docker.com/install/linux/docker-ce/binaries/#install -static-binaries

This installation method is the most simple and correct, the rest of the online reference rpm, yum installation all have a variety of problems.

 

1. Download static binary file

go to https://download.docker.com/linux/static/stable/ (or change stable to edge or test), select your hardware platform, and then download. Tgz files related to the docker CE version to be installed.

 

2. Decompress

$ tar –xzvf docker-18.06.3- ce.tgz For this, please install it on demand

Required: move the binary file to a directory on the executable path, such as/usr/bin /.

——–Without this step, it is invalid to call docker under the docker file

$ sudo cp docker/* /usr/bin/

3. Start the docker daemon:

$ sudo dockerd&

Note: if the following error occurs when starting the daemons:

The reason is that CGroup is not mounted on the host computer. To add a mount, the solution is as follows:

vim /etc/fstab

none        /sys/fs/cgroup        cgroup        defaults    0    0

Save and restart.

4. Start the docker command test

docker -v

No repositories directory found inside registry_ DATA_ DIR

No repositories directory found inside registry_ DATA_ DIR

Registry uses delete_ docker_ registry_ Solution 1: modify the global configuration file solution 2: modify the third-party plug-in

Registry uses delete_ docker_ registry_ Image delete image

Delete the specified image:
/usr/local/bin/delete_ docker_ registry_ Image - I image name delete the specified image label:
/usr/local/bin/delete_ docker_ registry_ Image - I image name: label

Delete error

REGISTRY_ DATA_ Dir is the directory corresponding to the private library file mapped to the local volume

[root@bigdata ~]# delete_docker_registry_image --image ssh-web-console:latest
No repositories directory found inside REGISTRY_DATA_DIR /opt/registry_data/docker/registry/v2

Solution 1: modify the global configuration file

This method is suitable for using delete on the server_ docker_ registry_ Image three party plug-in for image deletion of docker private library

[root@bigdata ~]# vim /etc/profile
'''
export REGISTRY_DATA_DIR=/data/docker/registry/docker/registry/v2
"/etc/profile" 86L, 2182C 

Solution 2: modify the third-party plug-in

This method is applicable to the server, and it is also applicable to delete when calling shell command with background service_ docker_ registry_ Image three party plug-in for image deletion of docker private library

[root@bigdata ~]# vim /usr/local/bin/delete_docker_registry_image
'''
	if 'REGISTRY_DATA_DIR' in os.environ:
        registry_data_dir = os.environ['REGISTRY_DATA_DIR']
    else:
        registry_data_dir = "/root/data/registry/docker/registry/v2"//Here is the path to your own mirror repository
 
    try:
        cleaner = RegistryCleaner(registry_data_dir, dry_run=args.dry_run)
        if args.untagged:
            cleaner.delete_untagged(image)
        else:
            if tag:
                cleaner.delete_repository_tag(image, tag)
            else:
                cleaner.delete_entire_repository(image)
 
        if args.prune:
            cleaner.prune()
    except RegistryCleanerError as error:
        logger.fatal(error)
        sys.exit(1)
 
 
if __name__ == "__main__":
    main()

How to Solve Error: Driver “kvm2“ not found

This error occurred in the environment of Ubuntu 16.04. According to the official KVM installation mode, starting minicube still reported an error

curl -LO https://storage.googleapis.com/minikube/releases/v0.30.0/docker-machine-driver-kvm2
chmod +x docker-machine-driver-kvm2
sudo mv docker-machine-driver-kvm2 /usr/local/bin/

As above, after installing docker-machine-driver-kvm2 (note that the version should not be too new)

docker-compose Error Traceback (most recent call last)

docker-compose problem Traceback (most recent call last) Description.
After executing walle (walle) to automatically deploy the image, execute
docker-compose up -d && docker-compose logs -f
The error is reported as follows.

How to Solve:
pip uninstall requests
pip install –ignore-installed requests

Traceback (most recent call last):
File “/usr/local/lib/python3.9/site-packages/urllib3/connectionpool.py”, line 699, in urlopen
httplib_response = self._make_request(
File “/usr/local/lib/python3.9/site-packages/urllib3/connectionpool.py”, line 394, in _make_request
conn.request(method, url, **httplib_request_kw)
File “/usr/local/Cellar/[email protected]/3.9.2_4/Frameworks/Python.framework/Versions/3.9/lib/python3.9/http/client.py”, line 1255, in request
self._send_request(method, url, body, headers, encode_chunked)
File “/usr/local/Cellar/[email protected]/3.9.2_4/Frameworks/Python.framework/Versions/3.9/lib/python3.9/http/client.py”, line 1301, in _send_request
self.endheaders(body, encode_chunked=encode_chunked)
File “/usr/local/Cellar/[email protected]/3.9.2_4/Frameworks/Python.framework/Versions/3.9/lib/python3.9/http/client.py”, line 1250, in endheaders
self._send_output(message_body, encode_chunked=encode_chunked)
File “/usr/local/Cellar/[email protected]/3.9.2_4/Frameworks/Python.framework/Versions/3.9/lib/python3.9/http/client.py”, line 1010, in _send_output
self.send(msg)
File “/usr/local/Cellar/[email protected]/3.9.2_4/Frameworks/Python.framework/Versions/3.9/lib/python3.9/http/client.py”, line 950, in send
self.connect()
File “/usr/local/lib/python3.9/site-packages/docker/transport/unixconn.py”, line 43, in connect
sock.connect(self.unix_socket)
FileNotFoundError: [Errno 2] No such file or directory