Tag Archives: docker

[Solved] docker Start jar package and Set JVM parameter Error

Error Messages:
Unrecognized option: -server -XX:MetaspaceSize=256m -XX:MaxMetaspaceSize=256m -Xms512m -Xmx1024m -Xmn512m -Xss256k -XX:SurvivorRatio=8 -XX:+UseConcMarkSweepGC -Dtask=true
Error: Could not create the Java Virtual Machine.
Background:
Setting JVM parameters and then using docker file to start jar package reported an error.
Solution:
Use the ENTRYPOINT exec command.
ENV jvm_opts=”-server -XX:MetaspaceSize=256m -XX:MaxMetaspaceSize=256m -Xms512m -Xmx1024m -Xmn512m -Xss256k -XX:S
urvivorRatio=8 -XX:+UseConcMarkSweepGC -Dtask=true”

ENTRYPOINT exec java -jar $jvm_opts trade-chat.jar $app_arg

[Solved] Gunicorn timeout error: worker timeout

Gunicorn timeout error: worker timeout

I. Problem Description:

One morning, the developer suddenly reported a failure and the container restarted inexplicably. After checking the business container log, the worker timeout field was found

II. Analysis of error reporting reasons:

It can be seen from the error message that the worker process of gunicorn timed out, causing the process to exit and restart. Check the official website. The official website explains that the default timeout of gunicorn is 30s. If it exceeds 30s, the worker process will be killed and restarted.

III Solution:

Add: -- timeout 600 to gunicorn’s startup command to set the timeout to 600 seconds– Graceful timeout 600 indicates that the graceful timeout is 600 seconds

After the setting is completed, it is verified through kustomize inspection and re-distribution. It is found that the problem does not occur in the follow-up

[Solved] Docker failed to delete image error: no such image: CentOS

The docker image cannot be deleted. If you view the image through docker images, it clearly exists, but it cannot be deleted.

Deletion prompt: error: no such image: XXXXXXXX

The specific screenshots are as follows:

Problem solving:

get into

cd /var/lib/docker/image/overlay2/imagedb/content/sha256

This directory is all the image files in docker

Which to delete? Don’t panic, image ID in docker images can determine the image file.

Delete the file after confirmation: RM -rf + file name

After deletion, there is no in the docker images list.

ubuntu docker dm_task_run failed error [How to Solve]

Problem Description:

[root@yisu-6144357b1dcaa docker]# docker rm 7226093de996
Error response from daemon: container 7226093de99632756b9b35caadb98e0db783aa3db04fc39d7d8323250b24445d: driver "devicemapper" failed to remove root filesystem: failed to remove device be2f5fe82905d8d1550717f86a0e72274e58d238331739da3bd15b86843e9444: devicemapper: Error running DeleteDevice dm_task_run failed

Solution:
1. systemctl stop docker
2. thin_check /var/lib/docker/devicemapper/devicemapper/metadata
3. thin_check –clear-needs-check-flag /var/lib/docker/devicemapper/devicemapper/metadata
4. systemctl start docker

 

[Solved] docker: Error response from daemon: OCI runtime create failed: container_linux.go:380

docker: Error response from daemon: OCI runtime create failed: container_ linux. Go: 380 error reporting solution

Docker installs mysql5.0 7 fails to run and reports OCI runtime create failed

Pull mysql5 on docker 7 no problem
execute the code and report an error

docker run -p 3306:3306 --name mysql \
-v /mydata/mysql/log:/var/log/mysql \
-v /mydata/mysql/data:/var/lib/mysql \
-v /mydata/mysql/conf:/etc/mysql \
-e MYSQL_ROOT_PASSWORD=root \
-d mysql:5.7

CD goes to/mydata/MySQL/conf and finds that it is not mounted correctly, and there is no file path of/etc/MySQL

Error reason: the docker version needs to be downgraded or reinstalled because of the compatibility between Linux and docker

There are two solutions:

Reinstall the docker of the specified version and demote the docker to the specified version

The first method: uninstall and reinstall:

//Step 1: Uninstall docker

//List the packages downloaded by docker
sudo yum list installed | grep docker

//remove all the above related installed packages sudo yum -y remove "above show related packages"
sudo yum -y remove docker-ce.x86_64
sudo yum -y remove docker-ce-cli.x86_64

// Remove related images and containers
sudo rm -rf /var/lib/docker

sudo yum remove docker \
                  docker-client \
                  docker-client-latest \
                  docker-common \
                  docker-latest \
                  docker-latest-logrotate \
                  docker-logrotate \
                  docker-selinux \
                  docker-engine-selinux \
                  docker-engine
                 
// Test for deletion of
docker -v


// Step 2: reinstall the specified version of docker

// Install some necessary system tools.
sudo yum install -y yum-utils device-mapper-persistent-data lvm2

// Add software source information: sudo yum-config -y
sudo yum-config-manager --add-repo http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo

//Update the yum cache.
sudo yum makecache fast

//View the available versions of Docker-ce: sudo yum list docker-ce
yum list docker-ce --showduplicates | sort -r

// If you need to show only table versions, you can turn off the list for test versions: yum list
sudo yum-config-manager --enable docker-ce-edge
sudo yum-config-manager --enable docker-ce-test

//Update the yum package index
yum makecache fast

//Install the specified version of docker-ce: sudo yum install -y docker-ce
sudo yum install -y docker-ce-17.03.2.ce-1.el7.centos 

// Error: If the installation of the specified version of docker shows that the specified version of the docker-ce-selinux dependency package needs to be installed, please install.
yum install -y https://download.docker.com/linux/centos/7/x86_64/stable/Packages/docker-ce-selinux-17.03.2.ce-1.el7.centos.noarch.rpm 

Then pull MySQL again

docker pull mysql:5.7

The second method: downgrade docker to the specified version:

//Stop docker
sudo systemctl stop docker
//Enter the downgrade command
yum downgrade --setopt=obsoletes=0 -y docker-ce-17.03.2.ce-1.el7 docker-ce-selinux-17.03.2.ce-1.el7 containerd.io
//Checking the docker version
docker -v

Recreate the container and start

docker run -p 3306:3306 --name mysql \
-v /mydata/mysql/log:/var/log/mysql \
-v /mydata/mysql/data:/var/lib/mysql \
-v /mydata/mysql/conf:/etc/mysql \
-e MYSQL_ROOT_PASSWORD=root \
-d mysql:5.7

success!!

[Solved] Docker error: “unknown runtime specified NVIDIA” using GPU“

Question 1 recurrence

System: Ubuntu 18.04 docker version: 20.10.7
when I start a container, run the following command:

docker run -itd \
   --runtime=nvidia --gpus=all \
   -e NVIDIA_DRIVER_CAPABILITIES=compute,utility,video,graphics \
   image_name
   

report errors:

docker: Error response from daemon: Unknown runtime specified nvidia.
See 'docker run --help'.

Solution 1

This is because the user did not join the docker group and added his own user to the docker user group.

sudo usermod -a -G docker $USER

Question 2 recurrence

docker: Error response from daemon: Unknown runtime specified nvidia.
See 'docker run --help'.

Solution 2

NVIDIA docker2 needs to be installed

sudo apt-get install -y nvidia-docker2

Restart docker

sudo systemctl daemon-reload
sudo systemctl restart docker

[Solved] Docker startup container error: permission denied””: unknown.

Docker installation is completed, an error is reported when starting the container, and the startup fails:

**

docker: Error response from daemon: OCI runtime create failed:
container_linux.go:345: starting container process caused
“process_linux.go:430: container init caused “write
/proc/self/attr/keycreate: permission denied””: unknown.

**
reason:

“Write/proc/self/attr/keycreate: permission denied” indicates that the file does not have write permission and access is denied

Solution:

Change the SELinux attribute in the config file under/etc/SELinux to the disabled
step

vi /etc/selinux/config

You can see that the attribute inside is: enforcementmandatory

Change the SELinux property to disabled

Restart docker and start the container

[Solved] Docker failed to start daemon: error initializing graphdriver: driver not supported

When the kubelet node joins, an error VFS not support is reported

[ERROR SystemVerification]: unsupported graph driver: vfs

/etc/docker/daemon.json

{
        "registry-mirrors":["https://registry.docker-cn.com"],
        "bridge":"nufront-br",
        "storage-driver":"devicemapper",   ####
        "exec-opts": ["native.cgroupdriver=systemd"],
        "insecure-registries": ["hadoop03:5000"]
}

###
systemctl daemon-reload
service docker start #Note error initializing graphdriver: driver not supported

reference resources: https://github.com/moby/moby/issues/15651, it is found that the current node downloads the docker CE decompression package and directly configures the service, not through Yum (offline environment…)

#### 

[root@nufront-worker-02 bin]# cd /opt/module/docker/
[root@nufront-worker-02 docker]# ll

-rwxr-xr-x 1 root root 39593864 Nov 23 11:12 containerd
-rwxr-xr-x 1 root root 21508168 Nov 23 11:12 ctr
-rwxr-xr-x 1 root root 60073904 Nov 23 11:12 docker
-rwxr-xr-x 1 root root 78951368 Nov 23 11:12 dockerd
-rwxr-xr-x 1 root root   708616 Nov 23 11:12 docker-init
-rwxr-xr-x 1 root root  2933646 Nov 23 11:12 docker-proxy


Try RPM installation

#######
[root@nufront-worker-02 docker]# ll
total 350072
-rw-r--r-- 1 root root   104408 Nov 23 11:12 audit-libs-2.8.5-4.el7.x86_64.rpm
-rw-r--r-- 1 root root    78256 Nov 23 11:12 audit-libs-python-2.8.5-4.el7.x86_64.rpm
-rwxr-xr-x 1 root root 39593864 Nov 23 11:12 containerd
-rw-r--r-- 1 root root 35130608 Nov 23 11:12 containerd.io-1.4.6-3.1.el7.x86_64.rpm
-rwxr-xr-x 1 root root  7270400 Nov 23 11:12 containerd-shim
-rwxr-xr-x 1 root root  9953280 Nov 23 11:12 containerd-shim-runc-v2
-rw-r--r-- 1 root root    40816 Nov 23 11:12 container-selinux-2.119.2-1.911c772.el7_8.noarch.rpm
-rwxr-xr-x 1 root root 21508168 Nov 23 11:12 ctr
-rwxr-xr-x 1 root root 60073904 Nov 23 11:12 docker
-rw-r--r-- 1 root root 27902344 Nov 23 11:12 docker-ce-20.10.7-3.el7.x86_64 (1).rpm
-rw-r--r-- 1 root root 34717572 Nov 23 11:12 docker-ce-cli-20.10.7-3.el7.x86_64.rpm
-rw-r--r-- 1 root root  9659320 Nov 23 11:12 docker-ce-rootless-extras-20.10.7-3.el7.x86_64.rpm
-rwxr-xr-x 1 root root 78951368 Nov 23 11:12 dockerd
-rwxr-xr-x 1 root root   708616 Nov 23 11:12 docker-init
-rwxr-xr-x 1 root root  2933646 Nov 23 11:12 docker-proxy
-rw-r--r-- 1 root root  4373740 Nov 23 11:12 docker-scan-plugin-0.8.0-3.el7.x86_64.rpm
-rwxr-xr-x 1 root root     1200 Nov 23 11:12 docker.service
-rw-r--r-- 1 root root    83764 Nov 23 11:12 fuse3-libs-3.6.1-4.el7.x86_64.rpm
-rw-r--r-- 1 root root    95424 Nov 23 11:12 fuse-libs-2.9.2-11.el7.x86_64.rpm
-rw-r--r-- 1 root root    55796 Nov 23 11:12 fuse-overlayfs-0.7.2-6.el7_8.x86_64.rpm
-rw-r--r-- 1 root root    67720 Nov 23 11:12 libcgroup-0.41-21.el7.x86_64.rpm
-rw-r--r-- 1 root root   101800 Nov 23 11:12 libcgroup-tools-0.41-21.el7.x86_64.rpm
-rw-r--r-- 1 root root    56824 Nov 23 11:12 libnetfilter_conntrack-1.0.6-1.el7_3.x86_64.rpm
-rw-r--r-- 1 root root    57460 Nov 23 11:12 libseccomp-2.3.1-4.el7.x86_64.rpm
-rw-r--r-- 1 root root   166012 Nov 23 11:12 libselinux-2.5-15.el7.x86_64.rpm
-rw-r--r-- 1 root root   154876 Nov 23 11:12 libselinux-utils-2.5-15.el7.x86_64.rpm
-rw-r--r-- 1 root root   154244 Nov 23 11:12 libsemanage-2.5-14.el7.x86_64.rpm
-rw-r--r-- 1 root root   115284 Nov 23 11:12 libsemanage-python-2.5-14.el7.x86_64.rpm
-rw-r--r-- 1 root root   304196 Nov 23 11:12 libsepol-2.5-10.el7.x86_64.rpm
-rw-r--r-- 1 root root    78740 Nov 23 11:12 libsepol-devel-2.5-10.el7.x86_64 (1).rpm
-rw-r--r-- 1 root root    78740 Nov 23 11:12 libsepol-devel-2.5-10.el7.x86_64.rpm
-rw-r--r-- 1 root root   938736 Nov 23 11:12 policycoreutils-2.5-34.el7.x86_64.rpm
-rw-r--r-- 1 root root   468316 Nov 23 11:12 policycoreutils-python-2.5-34.el7.x86_64.rpm
-rwxr-xr-x 1 root root 14485560 Nov 23 11:12 runc
-rw-r--r-- 1 root root   509568 Nov 23 11:12 selinux-policy-3.13.1-268.el7_9.2.noarch.rpm
-rw-r--r-- 1 root root  7335504 Nov 23 11:12 selinux-policy-targeted-3.13.1-268.el7_9.2.noarch.rpm
-rw-r--r-- 1 root root    83452 Nov 23 11:12 slirp4netns-0.4.3-4.el7_8.x86_64.rpm

[root@nufront-worker-02 docker]# rpm -ivh *.rpm  --nodeps --force 


[root@nufront-worker-02 docker]# yum list installed | grep docker
docker-ce.x86_64                        3:20.10.7-3.el7                installed
docker-ce-cli.x86_64                    1:20.10.7-3.el7                installed
docker-ce-rootless-extras.x86_64        20.10.7-3.el7                  installed
docker-scan-plugin.x86_64               0.8.0-3.el7                    installed

Docker can be started again…

[root@nufront-worker-02 docker]# docker info
Client:
 Context:    default
 Debug Mode: false
 Plugins:
  app: Docker App (Docker Inc., v0.9.1-beta3)
  buildx: Build with BuildKit (Docker Inc., v0.5.1-docker)
  scan: Docker Scan (Docker Inc., v0.8.0)

Server:
 Containers: 0
  Running: 0
  Paused: 0
  Stopped: 0
 Images: 0
 Server Version: 20.10.7
 Storage Driver: devicemapper ###
  Pool Name: docker-253:0-812466384-pool
  Pool Blocksize: 65.54kB
  Base Device Size: 10.74GB
  Backing Filesystem: xfs
  Udev Sync Supported: true
  Data file: /dev/loop0
  Metadata file: /dev/loop1
  Data loop file: /var/lib/docker/devicemapper/devicemapper/data
  Metadata loop file: /var/lib/docker/devicemapper/devicemapper/metadata
  Data Space Used: 11.8MB
  Data Space Total: 107.4GB
  Data Space Available: 107.4GB
  Metadata Space Used: 581.6kB
  Metadata Space Total: 2.147GB
  Metadata Space Available: 2.147GB
  Thin Pool Minimum Free Space: 10.74GB
  Deferred Removal Enabled: true
  Deferred Deletion Enabled: true
  Deferred Deleted Device Count: 0
  Library Version: 1.02.107-RHEL7 (2015-10-14)
 Logging Driver: json-file
 Cgroup Driver: systemd
 Cgroup Version: 1
 Plugins:
...

Error: Cannot find module ‘png-js‘ [How to Solve]

The following error is suddenly found in the execution script:

Error: cannot find module ‘PNG-JS’

the reason is that the docker container lacks module’ PNG-JS’. Here, execute the following command to install the module:

sudo docker exec -it Containner_name pnpm i png-js