Docker error h3>
Warning: failed to get default registry endpoint from daemon (Cannot connect to the Docker daemon. Is the docker daemon running on this host?) .
operating system: CentOS7
execution command: docker info
, docker search
, docker pull
execution user: non-root, has sudo permission
guess error and execute user permission, use sudo docker info
will also report error, but docker --version
normal
execute sudo dockerd
after CTRL +c interrupt, stop docker service and then restart, then use sudo docker info
normal, No attempt to use root user directly is normal
停服启动命令
$ sudo systemctl stop docker.service
$ sudo systemctl start docker.service
不加sudo依然会报以下错误
被允许否认在试图连接到码头工人在unix守护进程插座:/// var /运行/码头工人。袜子:获取http://%2Fvar%2Frun%2Fdocker.sock/v1.38/info:拨打unix/var/run/docker.html。sock: connect:权限被拒绝
div>
Failed to add /run/systemd/ask-password to directory watch: No space left on device?
cloud server after docker is installed successfully, enter the start command:
sudo service docker start
system threw an exception: Failed to add /run/systemd/ask-password to directory watch: No space left on device
check the server space usage and find that it is not a server space problem. Upon examination, it was found that the following method could be used:
for immediate effect: add monitoring space
on the command line
sudo -i
echo 1048576 > /proc/sys/fs/inotify/max_user_watches
exit
or you can modify the configuration file to make monitoring long term:
sudo vim /etc/sysctl.conf
and then add:
to the end of the file
fs.inotify.max_user_watches=1048576
save and exit, and then enter the start docker command.
Nextcloud error: “access forbidden CSRF check failed”
### reproduce step
1. Log in with any user
2. Try to exit
3. Error
p>
### expected behavior
user should log out.
Nextcloud report error :”Access forbidden CSRF check failed”
Nextcloud to configure Nginx cross-region solution
### actual behavior
user clicks logout with error:
“Access forbidden
CSRF check failed”
p>
### solution (configure nginx)
1. The first part is to mapmap in the HTTP in the global configuration (default path /etc/nginx/nginx.conf);
First configure nginx.conf add HTTP map
vi /etc/nginx/nginx.conf
# added to HTTP save
map $http_upgrade $connection_upgrade {
default upgrade; '' close;
}
p>
2. The second part, it is the corresponding nextcloud configuration file (create/etc/nginx/conf. D/nextcloud. Conf) under the span> server IP configuration.
Configure nextcloud.conf inverse configuration file by adding
vi/etc/nginx/conf. D/nextcloud. Conf p>
proxy_set_header Host $http_host;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection $connection_upgrade;
p>
After
configuration is completed, run nginx-t to check, and confirm that there is no error, run nginx-s reload or systemctl restart nginx to restart nginx for effective configuration.
p>
3. After completion, visiting Nextcloud again may appear: reverse proxy domain is not in the trusted_domain of Nextcloud your visiting domain is not in the trusted domain of Nextcloud
#
modify $nextcloud/config/config in PHP trusted_domains parameters can span> p>
cadvisor Failed to start container manager: inotify_add_watch /sys/fs/cgroup/cpuacct,cpu: nosuchfile
# 报错如下:
[xxx@izgtdlcgloqnfyz ~]# docker logs ba2d4ab942f9
W1022 06:12:09.413462 1 manager.go:349] Could not configure a source for OOM detection, disabling OOM events: open /dev/kmsg: no such file or directory
F1022 06:12:09.504230 1 cadvisor.go:172] Failed to start container manager: inotify_add_watch /sys/fs/cgroup/cpuacct,cpu: no such file or directory
# 解决
sudo mount -o remount,rw '/sys/fs/cgroup'
sudo ln -s /sys/fs/cgroup/cpu,cpuacct /sys/fs/cgroup/cpuacct,cpu
div>
systemctl start docker Job for docker.service failed because the control process exited with error
[root@tbase1 ~]# systemctl start docker
Job for docker.service failed because the control process exited with error code. See "systemctl status docker.service" and "journalctl -xe" for details.
[root@tbase1 ~]#
[root@tbase1 ~]# journalctl -xe
Oct 22 11:10:36 tbase1 systemd[1]: Unit docker.service entered failed state.
Oct 22 11:10:36 tbase1 systemd[1]: docker.service failed.
Oct 22 11:10:38 tbase1 systemd[1]: docker.service holdoff time over, scheduling restart.
Oct 22 11:10:38 tbase1 systemd[1]: Stopping Docker Socket for the API.
-- Subject: Unit docker.socket has begun shutting down
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- Unit docker.socket has begun shutting down.
Oct 22 11:10:38 tbase1 systemd[1]: Starting Docker Socket for the API.
-- Subject: Unit docker.socket has begun start-up
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- Unit docker.socket has begun starting up.
Oct 22 11:10:38 tbase1 systemd[1]: Listening on Docker Socket for the API.
-- Subject: Unit docker.socket has finished start-up
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- Unit docker.socket has finished starting up.
--
-- The start-up result is done.
Oct 22 11:10:38 tbase1 systemd[1]: start request repeated too quickly for docker.service
Oct 22 11:10:38 tbase1 systemd[1]: Failed to start Docker Application Container Engine.
-- Subject: Unit docker.service has failed
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- Unit docker.service has failed.
--
-- The result is failed.
Oct 22 11:10:38 tbase1 systemd[1]: Unit docker.service entered failed state.
Oct 22 11:10:38 tbase1 systemd[1]: docker.service failed.
[root@tbase1 ~]# systemctl stop docker
[root@tbase1 ~]#
[root@tbase1 ~]#
[root@tbase1 ~]# systemctl start docker
Job for docker.service failed because start of the service was attempted too often. See "systemctl status docker.service" and "journalctl -xe" for details.
To force a start use "systemctl reset-failed docker.service" followed by "systemctl start docker.service" again.
[root@tbase1 ~]#
[root@tbase1 ~]#
Json to /etc/docker/ daemone.conf, but not daemone.json. But mine is the newly installed Docker, /etc/docker has no such file under it.
[root@tbase1 docker]# cd /etc/docker/
[root@tbase1 docker]# ls
key.json
[root@tbase1 docker]#
3. Start dockerd directly and check the log
[root@tbase1 docker]# dockerd
INFO[2020-10-22T11:17:08.729949738+08:00] Starting up
INFO[2020-10-22T11:17:08.732247548+08:00] parsed scheme: "unix" module=grpc
INFO[2020-10-22T11:17:08.732274835+08:00] scheme "unix" not registered, fallback to default scheme module=grpc
INFO[2020-10-22T11:17:08.732298172+08:00] ccResolverWrapper: sending update to cc: {[{unix:///run/containerd/containerd.sock 0 <nil>}] <nil>} module=grpc
INFO[2020-10-22T11:17:08.732306615+08:00] ClientConn switching balancer to "pick_first" module=grpc
INFO[2020-10-22T11:17:08.733766403+08:00] parsed scheme: "unix" module=grpc
INFO[2020-10-22T11:17:08.733793158+08:00] scheme "unix" not registered, fallback to default scheme module=grpc
INFO[2020-10-22T11:17:08.733807436+08:00] ccResolverWrapper: sending update to cc: {[{unix:///run/containerd/containerd.sock 0 <nil>}] <nil>} module=grpc
INFO[2020-10-22T11:17:08.733813642+08:00] ClientConn switching balancer to "pick_first" module=grpc
failed to start daemon: error initializing graphdriver: /var/lib/docker contains several valid graphdrivers: overlay2, devicemapper; Please cleanup or explicitly choose storage driver (-s <DRIVER>)
[root@tbase1 docker]#
error mainly due to failed to start daemon: error initializing graphdriver: /var/lib/docker contains several valid graphdrivers: overlay2, devicemapper; Please cleanup or explicitly choose storage driver (-s < DRIVER>) .
4, according to the above error, first put /var/lib/docker under overlay2,devicemapper mv drop
[root@tbase1 docker]# cd /var/lib/
[root@tbase1 lib]# ls
AccountsService color dnsmasq geoclue misc pacemaker pulse spamassassin upower
alsa colord docker gssproxy mlocate PackageKit rasdaemon stateless virtuoso
alternatives containerd dovecot hyperv net-snmp pcp rhsm stolon vmware
amanda containers etcd initramfs NetworkManager pcsd rpcbind systemd xkb
authconfig corosync flatpak iscsi nfs Pegasus rpm tpm yum
bluetooth cs fprint libvirt openlmi-registration plymouth rpm-state tuned
chrony dbus games logrotate openlmi-storage polkit-1 rsyslog udisks2
cockpit dhclient gdm machines os-prober postfix samba unbound
[root@tbase1 lib]# cd docker/
[root@tbase1 docker]# ls
containers devicemapper image network overlay2 plugins runtimes swarm tmp trust volumes
[root@tbase1 docker]#
[root@tbase1 docker]#
[root@tbase1 docker]# mv overlay2 overlay2_back
[root@tbase1 docker]# mv devicemapper/ devicemapper_bak
[root@tbase1 docker]# ls -ltr
total 0
drwx------ 4 root root 32 Aug 23 20:02 plugins
drwx------ 2 root root 6 Aug 23 20:02 trust
drwxr-x--- 3 root root 19 Aug 23 20:02 network
drwx------ 2 root root 6 Aug 23 20:02 swarm
drwx------ 4 root root 42 Aug 23 20:09 image
drwx------ 5 root root 53 Aug 23 20:10 devicemapper_bak
drwx------ 3 root root 78 Aug 23 20:10 containers
drwx------ 3 root root 97 Aug 23 20:10 volumes
drwx------ 2 root root 6 Oct 22 11:17 tmp
drwx------ 2 root root 6 Oct 22 11:17 runtimes
drwx------ 3 root root 40 Oct 22 11:17 overlay2_back
5. Start docker
again
[root@tbase1 docker]# systemctl start docker
[root@tbase1 docker]# systemctl status docker
● docker.service - Docker Application Container Engine
Loaded: loaded (/usr/lib/systemd/system/docker.service; disabled; vendor preset: disabled)
Active: active (running) since Thu 2020-10-22 11:19:37 CST; 27s ago
Docs: https://docs.docker.com
Main PID: 1926 (dockerd)
Memory: 56.0M
CGroup: /system.slice/docker.service
└─1926 /usr/bin/dockerd -H fd:// --containerd=/run/containerd/containerd.sock
Oct 22 11:19:36 tbase1 dockerd[1926]: time="2020-10-22T11:19:36.905481889+08:00" level=info msg="scheme \"unix\" no...e=grpc
Oct 22 11:19:36 tbase1 dockerd[1926]: time="2020-10-22T11:19:36.905497425+08:00" level=info msg="ccResolverWrapper:...e=grpc
Oct 22 11:19:36 tbase1 dockerd[1926]: time="2020-10-22T11:19:36.905504796+08:00" level=info msg="ClientConn switchi...e=grpc
Oct 22 11:19:36 tbase1 dockerd[1926]: time="2020-10-22T11:19:36.917251460+08:00" level=info msg="Loading containers: start."
Oct 22 11:19:37 tbase1 dockerd[1926]: time="2020-10-22T11:19:37.071539867+08:00" level=info msg="Default bridge (do...dress"
Oct 22 11:19:37 tbase1 dockerd[1926]: time="2020-10-22T11:19:37.099207556+08:00" level=info msg="Loading containers: done."
Oct 22 11:19:37 tbase1 dockerd[1926]: time="2020-10-22T11:19:37.147549150+08:00" level=info msg="Docker daemon" com....03.13
Oct 22 11:19:37 tbase1 dockerd[1926]: time="2020-10-22T11:19:37.147636946+08:00" level=info msg="Daemon has complet...ation"
Oct 22 11:19:37 tbase1 dockerd[1926]: time="2020-10-22T11:19:37.164192481+08:00" level=info msg="API listen on /var....sock"
Oct 22 11:19:37 tbase1 systemd[1]: Started Docker Application Container Engine.
Hint: Some lines were ellipsized, use -l to show in full.
p>
div>
Fedora32 start container error – OCI runtime create failed: This version of runc doesn’t work on cgroups V2: unknown
background: Fedora 32 version of the operating system, running the container times error
[root@Fedora4 ~]# docker run -d -p 1001:80 --name blog1 tutum/wordpress
97da5679108744a76fda3e171d49304cce059091ee321d6fd08c8d61a4300ee8
docker: Error response from daemon: OCI runtime create failed: this version of runc doesn't work on cgroups v2: unknown.
try again to start the container as well:
[root@Fedora4 ~]# docker start blog1
Error response from daemon: OCI runtime create failed: this version of runc doesn't work on cgroups v2: unknown
The
solution is configured as follows:
[root@Fedora4 ~]# grubby --update-kernel=ALL --args="systemd.unified_cgroup_hierarchy=0"
[root@Fedora4 ~]# reboot
after restart, the container can be started normally.
[root@Fedora4 ~]# docker start blog1
blog1
[root@Fedora4 ~]# docker ps -a
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
97da56791087 tutum/wordpress "/run.sh" 4 minutes ago Up 11 seconds 3306/tcp, 0.0.0.0:1001->80/tcp blog1
Reference documents:
p>
https://jaranguda.com/fedora-docker-this-version-of-runc-doesnt-work-on-cgroups-v2/
(20200916 Solved)Docker||redis-cli Could not connect to Redis at 127.0.0.1:6379: Connection refused
-
problem description
redis-cli is the redis command line interface to interact with the redis service.
-
solution
-
via configuration file
$ vi /etc/redis.conf # daemonize no 改为 yes redis-server /etc/redis.conf
docker startup redis has no configuration file in it. You need to build it yourself.
-
start directly
redis-server &
李> ol> 李> <李>
引用 h2> 李> ul>
- 无法连接到127.0.0.1:6379的Redis:使用自制程序拒绝连接
div>
-
Constructing docker image of multi arch
sometimes we want to build images that can run on machines with different hardware architectures (mainly arm architectures) to better meet the requirements of a heterogeneous distributed environment. Previously, the usual solution was to prepare multiple machines with different hardware architectures and compile and distribute them separately, but now Docker has a new (albeit experimental) buildx feature that solves this problem nicely.
buildx can be described in the relevant information, and it will not be repeated here. If you want to run locally, you can refer to this article: BUILDING DOCKER IMAGES FOR KUBERNETES RUNNING ON ARM. However, it is difficult to complete the configuration locally according to the actual measurement based on the current network environment, because it needs to connect with Docker.io in the whole process and need to download a large amount of data, so it is likely to disconnect halfway… So take a detour, use some third-party platform to complete the build, and release it to a mirrored warehouse.
I chose github actions because I saw that there were written actions on github, which greatly simplifies the configuration. With this script, you can build an image across the hardware architecture and publish it to docker hub:
docker:
name: Publish Docker Image
runs-on: ubuntu-18.04
env:
REPO: ${{ secrets.ENTITY_DOMAIN_REPO }}
steps:
- name: Set up QEMU
uses: docker/setup-qemu-action@v1
with:
platforms: all
- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v1
with:
version: latest
-
name: Available platforms
run: echo ${{ steps.buildx.outputs.platforms }}
# 可以在这里看到可以兼容哪些平台
- name: Login to Docker Registry
run: echo '${{ secrets.DOCKERHUB_PASS }}' | docker login -u ${{ secrets.DOCKERHUB_USER }} --password-stdin
- name: Build Docker Image
run: docker buildx build -t $REPO:latest --platform linux/amd64,linux/arm64 --push .
# 在--platform后面指定需要兼容的平台列表
div>
Failed to execute goal com.spotify:docker-maven-plugin:1.0.0:build Exception caught: basedir src/mai
执行goal com.spotify:docker-maven-plugin:1.0.0:build Exception caught: basedir src/main/docker不存在
使用docker部署Spring Cloud项目,一些代码在pomc .xml中:
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
<!-- tag::plugin[] -->
<plugin>
<groupId>com.spotify</groupId>
<artifactId>docker-maven-plugin</artifactId>
<version>1.0.0</version>
<configuration>
<imageName>${docker.image.prefix}/${project.artifactId}</imageName>
<dockerDirectory>src/main/docker</dockerDirectory>
<resources>
<resource>
<targetPath>/</targetPath>
<directory>${project.build.directory}</directory>
<include>${project.build.finalName}.jar</include>
</resource>
</resources>
</configuration>
</plugin>
<!-- end::plugin[] -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<skipTests>true</skipTests>
</configuration>
</plugin>
</plugins>
</build>
[INFO] [INFO] – spring-boot-maven-plugin:1.5.2。发布:repackage
(default) @ eureka-server- [INFO] [INFO] –
docker-maven-plugin:1.0.0:build (default-cli) @ eureka-server-
[ConfigFileRegistryAuthSupplier] [INFO]复制
/Users/eureka-server/target/eureka-server-0.0.1- snapshot .jar ->
/用户/ eureka-server /目标/码头工人/ eureka-server-0.0.1-SNAPSHOT.jar
[信息]——[信息]构建失败[信息]
-[信息]总时间:6.728秒[信息]了:
2017 – 11 – 15 – t20:51:07 +喂饲[信息]最后的记忆:41米/ 361 m[信息]
–
(错误)未能执行目标com.spotify: docker-maven-plugin: 1.0.0:构建(default-cli)项目
eureka-server:异常捕获:basedir src/main/docker不
存在->要查看
错误的完整堆栈跟踪,请使用-e开关重新运行Maven。[错误]使用
的-X开关重新运行Maven以启用完整的调试日志记录。[ERROR] [ERROR]更多
关于错误和可能的解决方案的信息,请阅读
以下文章:[ERROR] [Help 1]
http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException
引用>
我的项目有src/main/docker这个文件,怎么解决
将项目路径添加到dockerDirectory:
<dockerDirectory>${project.basedir}/src/main/docker</dockerDirectory>
pom.xml: p>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
<!-- tag::plugin[] -->
<plugin>
<groupId>com.spotify</groupId>
<artifactId>docker-maven-plugin</artifactId>
<version>1.0.0</version>
<configuration>
<imageName>${docker.image.prefix}/${project.artifactId}</imageName>
<dockerDirectory>${project.basedir}/src/main/docker</dockerDirectory>
<resources>
<resource>
<targetPath>/</targetPath>
<directory>${project.build.directory}</directory>
<include>${project.build.finalName}.jar</include>
</resource>
</resources>
</configuration>
</plugin>
<!-- end::plugin[] -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<skipTests>true</skipTests>
</configuration>
</plugin>
</plugins>
</build>
请查看我的stackoverflow:
https://stackoverflow.com/questions/47308102/ failedto -execute- target -com-spotifydocker-maven-plugin1-0- 0build-excep-cau
div>
Docker service start, restart, close command
docker official website address https://www.docker.com/
docker start command,docker restart command,docker close command
start systemctl start docker span> p>
daemon restart sudo systemctl daemon-reload
Docker docker
docker
sudo service docker restart
Docker stop service docker stop
Docker
Docker encountered a problem 4: yaml: Line 1: mapping values are not allowed in this context
refer to the example of the official document part3 and execute the docker stack deploy-c docker-composer. Yml getstartedlab
with the error message as follows:
cappuccinooos-MacBook-Pro:part3 cappuccinooo$ docker stack deploy -c docker-compose.yml getstartedlab
yaml: line 1: mapping values are not allowed in this context
from the error message can know, is docker – compose. Yml file format has a problem, yml file has strict requirements on the blank space indentation, direct copy the contents of the official document is not enough, the search on the net have tools to online check yml file format, format errors will give corresponding hint, feel quite convenient, and the link below: https://www.bejson.com/validators/yaml/ p>
after modifying the docker-composer. Yml, execute the docker stack deploy-c docker-composer. Yml getstartedlab
command successfully
cappuccinooos-MacBook-Pro:part3 cappuccinooo$ docker stack deploy -c docker-compose.yml getstartedlab
Creating network getstartedlab_webnet
Creating service getstartedlab_web
div>
View the IP address of the docker container
view the docker container address
docker inspect --format='{{.Name}} - {{range.NetworkSettings.Networks}}{{.IPAddress}}{{end}}' $(docker ps -aq)
div>