szcf-weiya / techNotes

My notes about tech (Linux/R/Julia/Python/Cpp/etc.)
https://tech.hohoweiya.xyz/
11 stars 7 forks source link

docker #29

Open szcf-weiya opened 3 years ago

szcf-weiya commented 3 years ago
~$ docker run -it makisyu/texlive-2016:latest
docker: Error response from daemon: failed to update store for object type *libnetwork.endpointCnt: Key not found in store.
ERRO[0000] error waiting for container: context canceled 

solution, https://stackoverflow.com/questions/57592703/failed-to-update-store-for-object-type-libnetwork-endpointcnt-key-not-found-in:

sudo service docker restart
szcf-weiya commented 3 years ago

makisyu/texlive-2016

~/github/techNotes/docs/TeX/example$ docker run -it -v $PWD:/workdir --workdir /workdir makisyu/texlive-2016 xelatex vargreek.tex
xelatex: error while loading shared libraries: libfontconfig.so.1: cannot open shared object file: No such file or directory

find https://stackoverflow.com/questions/13046555/wkhtmltopdf-libfontconfig-so-1-cannot-open-shared-object-file and run

# yum install libfontconfig1
Redirecting to '/usr/bin/dnf install libfontconfig1' (see 'man yum2dnf')

Fedora 25 - x86_64 - Updates                               1.2 MB/s |  24 MB     00:19    
Last metadata expiration check: 0:00:18 ago on Thu May 13 12:39:00 2021.
No package libfontconfig1 available.
Error: Unable to find a match.

since the environment is fedora https://docs.fedoraproject.org/en-US/Fedora/17/html/System_Administrators_Guide/sec-Installing.html

szcf-weiya commented 3 years ago
$ docker image ls
REPOSITORY   TAG       IMAGE ID   CREATED   SIZE
~$ docker container ls
CONTAINER ID   IMAGE     COMMAND   CREATED   STATUS    PORTS     NAMES
~$ docker image ls -a
REPOSITORY   TAG       IMAGE ID   CREATED   SIZE
# docker image ls -a
REPOSITORY   TAG       IMAGE ID   CREATED   SIZE

then try to run

$ docker run --name myXAMPP -p 41061:22 -p 41062:80 -d -v /media/weiya/PSSD/disqus20210518/:/var/www/disqus tomsik68/xampp:8
Unable to find image 'tomsik68/xampp:8' locally
8: Pulling from tomsik68/xampp
Digest: sha256:600ee55bff1d1e5ee239b59b621ae61b5398fdd68e1300578749abb4bb305be1
Status: Downloaded newer image for tomsik68/xampp:8
docker: Error response from daemon: layer does not exist.
See 'docker run --help'.

found that here is process

$ ps -ef | grep docke
root      5125     1  0 14:02 ?        00:00:00 /usr/bin/dockerd -H fd:// --containerd=/run/containerd/containerd.sock
weiya    16251 12594  0 14:20 pts/0    00:00:00 grep --color=auto docke

try to kill it,

$ sudo kill -s 9 5125

then

$ docker image ls -a
REPOSITORY       TAG       IMAGE ID       CREATED        SIZE
<none>           <none>    394d42476df5   2 weeks ago    8.22GB
tomsik68/xampp   8         b8a0b6811d82   8 weeks ago    1.37GB
<none>           <none>    d1165f221234   2 months ago   13.3kB
<none>           <none>    bb92f3e57f6b   4 years ago    5.42GB

succeed! but why?

attempt 1

find a similar issue, https://forums.docker.com/t/error-response-from-daemon-layer-does-not-exist/36386/2 so a remedy is to disable the autostart, refer to https://askubuntu.com/questions/766318/disable-docker-autostart-at-boot, firstly see which services are enabled,

$ systemctl list-unit-files | grep -i docker
docker.service                                                   enabled        
docker.socket                                                    enabled        

then disable them

$ sudo systemctl disable docker.service 
Removed /etc/systemd/system/multi-user.target.wants/docker.service.
$ sudo systemctl disable docker.socket 
Removed /etc/systemd/system/sockets.target.wants/docker.socket.

however,

~$ docker pull r-base:4.1.0
Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?

then start it

~$ sudo systemctl start docker
~$ ps -ef | grep docker
root     21458     1  8 18:33 ?        00:00:00 /usr/bin/dockerd -H fd:// --containerd=/run/containerd/containerd.sock
weiya    21887 20334  0 18:33 pts/1    00:00:00 grep --color=auto docker
~$ docker run -it r-base:4.1.0
Unable to find image 'r-base:4.1.0' locally
4.1.0: Pulling from library/r-base
420047682034: Pull complete 

after re-enabling docker, docker image ls returns empty, but after killing the running process, 5724, it would automatically re-run a program, then docker image ls resumes normal.

$ ps -ef | grep docker
root      5724     1  0 Jun18 ?        00:00:18 /usr/bin/dockerd -H fd:// --containerd=/run/containerd/containerd.sock
weiya    21079 14786  0 15:11 pts/1    00:00:00 grep --color=auto docker
$ sudo kill -s 9 5724
[sudo] password for weiya: 
$ ps -ef | grep docker
root     21171     1  0 15:12 ?        00:00:00 /usr/bin/dockerd -H fd:// --containerd=/run/containerd/containerd.sock
weiya    21205 14786  0 15:12 pts/1    00:00:00 grep --color=auto docker
szcf-weiya commented 3 years ago

dochat on G40

https://github.com/huan/docker-wechat but no window appears, at first, I am guessing it might be due to permission, since the folder created by docker is root:root, I suspect that I fail to run

sudo usermod -aG docker $USER

and list the current groups,

$ groups weiya
weiya : weiya adm cdrom sudo dip plugdev lpadmin sambashare docker

also check if weiya is in such group

$ id weiya 
uid=1000(weiya) gid=1000(weiya) groups=1000(weiya),4(adm),24(cdrom),27(sudo),30(dip),46(plugdev),113(lpadmin),128(sambashare),134(docker)

Try again, the folder is still root:root. Then I found this answer, https://stackoverflow.com/questions/39794793/docker-volume-option-create-folder-as-root-user which points out that this is a normal phenomenon. so I directly change the ownership via

sudo chown -R weiya:weiya DoChat/

Then I observe there is another issue related to no windows, https://github.com/huan/docker-wechat#no-main-window-after-start-up-with-2-or-more-monitor-setup

Without external monitor or in mirror mode, the wechat can be successfully loaded. Then switch to joint mode, and I can drag the wechat window to the external monitor. But strangely, I failed to drag it back. Hopefully, Alt + F7 (#30 ) works.

Change the monitor mode can be done in command line,

$ xrandr --output DP-1 --same-as eDP-1
$ xrandr --output DP-1 --right-of eDP-1

where the monitor names can be found by typing xrandr.

but the window is too small, it seems that DPI does not work.

Try a newer version, the WeChat can be launched in joint monitor mode, and also the DPI works, since it pops a window said that 已经适配至 125%,which is the default DPI setting. However, the input characters cannot be seen, as mentioned in https://github.com/huan/docker-wechat/issues/40

v0.11

tried the latest version,

$ curl -sL https://raw.githubusercontent.com/huan/docker-wechat/master/dochat.sh | DOCHAT_WECHAT_VERSION=0.11 bash

the window size and dpi seems OK, and input is OK, but cannot send images

szcf-weiya commented 3 years ago

not found the image name via

$ docker image ls -a

but found the container

$ docker container ls -a
CONTAINER ID   IMAGE             COMMAND                  CREATED        STATUS                     PORTS     NAMES
...
df3062159052   718fc671b39a      "R"                      7 days ago     Exited (0) 6 days ago                jovial_cori
...

and then

$ docker container start jovial_cori

then

$ docker container ls
CONTAINER ID   IMAGE          COMMAND   CREATED      STATUS         PORTS     NAMES
df3062159052   718fc671b39a   "R"       7 days ago   Up 2 minutes             jovial_cori

re-check the image

$ docker image ls | grep 718fc671b39a
$ docker image ls -a | grep 718fc671b39a
<none>       <none>    718fc671b39a   7 days ago      985MB

assign name and tag via

docker tag 718fc r4.1.0:latest

and here is a possible explanation for the loss tag and repo name https://stackoverflow.com/questions/30179716/what-are-none-repository-and-tags-why-do-they-appear-when-i-use-docker-build.