Description
Seem to be having issues tailing logs after upgrading to 17.09.0-ce. Was working on 17.06.0-ce
Steps to reproduce the issue:
- Create container
- Start container
- Tail logs
Describe the results you received:
20:34:13 Error grabbing logs: EOF
20:34:13 [localhost] local: git checkout ./.dockerignore
20:34:13 Traceback (most recent call last):
20:34:13 File "$PATH@2/venv/local/lib/python2.7/site-packages/fabric/main.py", line 743, in main
20:34:13 *args, **kwargs
20:34:13 File "$PATH@2/venv/local/lib/python2.7/site-packages/fabric/tasks.py", line 424, in execute
20:34:13 results['<local-only>'] = task.run(*args, **new_kwargs)
20:34:13 File "$PATH@2/venv/local/lib/python2.7/site-packages/fabric/tasks.py", line 174, in run
20:34:13 return self.wrapped(*args, **kwargs)
20:34:13 File "$PATH@2/fabfile/__init__.py", line 142, in run_e2e_tests
20:34:13 e2e_tests.run(specs)
20:34:13 File "$PATH@2/fabfile/e2e_tests.py", line 69, in run
20:34:13 docker_build.copy_from(build_tag, '/blend/e2e/artifacts/.', 'artifacts')
20:34:13 File "$PATH@2/fabfile/docker_build.py", line 240, in copy_from
20:34:13 with tarfile.open(mode='r|*', fileobj=container.get_archive(source)[0]) as tarball:
20:34:13 File "$PATH@2/venv/local/lib/python2.7/site-packages/docker/models/containers.py", line 194, in get_archive
20:34:13 return self.client.api.get_archive(self.id, path)
20:34:13 File "$PATH@2/venv/local/lib/python2.7/site-packages/docker/utils/decorators.py", line 19, in wrapped
20:34:13 return f(self, resource_id, *args, **kwargs)
20:34:13 File "$PATH@2/venv/local/lib/python2.7/site-packages/docker/utils/decorators.py", line 34, in wrapper
20:34:13 return f(self, *args, **kwargs)
20:34:13 File "/mnt/jenkins-slave/workspace/blend-test-e2e-multitenant@2/venv/local/lib/python2.7/site-packages/docker/api/container.py", line 732, in get_archive
20:34:13 self._raise_for_status(res)
20:34:13 File "$PATH@2/venv/local/lib/python2.7/site-packages/docker/api/client.py", line 222, in _raise_for_status
20:34:13 raise create_api_error_from_http_exception(e)
20:34:13 File "$PATH@2/venv/local/lib/python2.7/site-packages/docker/errors.py", line 31, in create_api_error_from_http_exception
20:34:13 raise cls(e, response=response, explanation=explanation)
Describe the results you expected:
Additional information you deem important (e.g. issue happens only occasionally):
Output of docker version
:
Client:
Version: 17.09.0-ce
API version: 1.32
Go version: go1.8.3
Git commit: afdb6d4
Built: Tue Sep 26 22:42:18 2017
OS/Arch: linux/amd64
Server:
Version: 17.09.0-ce
API version: 1.32 (minimum version 1.12)
Go version: go1.8.3
Git commit: afdb6d4
Built: Tue Sep 26 22:40:56 2017
OS/Arch: linux/amd64
Experimental: false
Output of docker info
:
Containers: 19
Running: 7
Paused: 0
Stopped: 12
Images: 40
Server Version: 17.09.0-ce
Storage Driver: overlay2
Backing Filesystem: extfs
Supports d_type: true
Native Overlay Diff: true
Logging Driver: json-file
Cgroup Driver: cgroupfs
Plugins:
Volume: local
Network: bridge host macvlan null overlay
Log: awslogs fluentd gcplogs gelf journald json-file logentries splunk syslog
Swarm: inactive
Runtimes: runc
Default Runtime: runc
Init Binary: docker-init
containerd version: 06b9cb35161009dcb7123345749fef02f7cea8e0
runc version: 3f2f8b84a77f73d38244dd690525642a72156c64
init version: 949e6fa
Security Options:
apparmor
seccomp
Profile: default
Kernel Version: REDACT
Operating System: Ubuntu 16.04.3 LTS
OSType: linux
Architecture: x86_64
CPUs: 8
Total Memory: 14.69GiB
Name: REDACT
ID: 4NVG:MGS6:QUMP:GA7Z:5CPC:UVA2:AA2Q:XIL4:PSCM:QMX4:SULJ:Y4XQ
Docker Root Dir: REDACT
Debug Mode (client): false
Debug Mode (server): true
File Descriptors: 118
Goroutines: 131
System Time: 2017-11-01T21:28:08.293959958Z
EventsListeners: 0
Registry: https://index.docker.io/v1/
Experimental: false
Insecure Registries:
127.0.0.0/8
Live Restore Enabled: false
WARNING: No swap limit support
Additional environment details (AWS, VirtualBox, physical, etc.):
Executed using docker-py python library.
container.logs(
follow=True,
stdout=True,
stderr=True,
stream=True,
tail=2
)
Docker can’t read logs #1984
Comments
Expected behavior
Be able to read docker logs, despite any error messages. docker events command should work or display some human-readable error
Actual behavior
When docker container is not stopped gracefully (ie computer is shut down while containers running), logs become corrupt and can no longer be read. Error message:
The command docker events will run forever without exiting or outputting anything.
My workaround so far has been to use «Remove all data» feature under «Reset» in preferences, but its frustrating to reinstall all containers whenever I forget to stop containers or computer auto-updates.
Information
Docker for Mac: version: 17.06.0-ce-mac19 (4cdec4294a50b2233146b09469b49937dabdebdd)
macOS: version 10.12.6 (build: 16G29)
logs: /tmp/A2C0DE10-7188-4A98-93D8-9EAD1A849527/20170822-104841.tar.gz
[OK] db.git
[OK] vmnetd
[OK] dns
[OK] driver.amd64-linux
[OK] virtualization VT-X
[OK] app
[OK] moby
[OK] system
[OK] moby-syslog
[OK] db
[OK] env
[OK] virtualization kern.hv_support
[OK] slirp
[OK] osxfs
[OK] moby-console
[OK] logs
[OK] docker-cli
[OK] menubar
[OK] disk
Steps to reproduce the behavior
- run containers
- shut down computer (w/o stopping them)
- start up and run containers
- attempt to access logs
The text was updated successfully, but these errors were encountered:
Источник
Error grabbing logs: unexpected EOF #913
I am currently using WatchTower to watch a container with a NodeJS application. The container works fine, however when it is restarted by WatchTower, after a little moment (and a few logs), an error occurs:
Error grabbing logs: unexpected EOF
The container stills works fine except for the logs which are not showing up in the console any more.
When I restart the container manually without using WatchTower, there is no log issue. Is there some flags I should use in the docker-compose file in order to make it work ?
Thank you in advance,
B.
Beta Was this translation helpful? Give feedback.
1 You must be logged in to vote
If the container is recreated, it will indeed break the connection to the log stream for docker-compose and discard any prior logs available through docker logs . This is unfortunately not something implemented in Watchtower, but how docker handles logs in general.
Replies: 6 suggested answers · 2 replies
Try using the latest version, containrrr/watchtower ( v2tec/watchtower is the abandoned project that containrrr adopted).
I don’t know if there are any differences in logging in the v2tec version and the current one, but it’s a better starting point. It does however sound like the issue is in whatever is reading the logs?
Beta Was this translation helpful? Give feedback.
1 You must be logged in to vote
Hi, thanks I will try this image. I am not sure where the issue is but the only clue I have is that it appears when the container is restarted by watchtower. I’ll see if the new image fixes the issue
Beta Was this translation helpful? Give feedback.
1 You must be logged in to vote
<>’s edit
<>’s edit
Well, the thing is that restarted doesn’t tell the full story. You cannot restart a container with a different image, so what watchtower does, is that it collects the container configuration, stops and removes the container. It then starts a new container using the same config, but based on the new image. So, if something is reading the logs from the container it would experience that the container goes away. From where do you get the Error grabbing logs: unexpected EOF message?
Beta Was this translation helpful? Give feedback.
1 You must be logged in to vote
<>’s edit
<>’s edit
Sorry, I took a shortcut saying restarted but basically I start my two containers (nodejs and watchtower) with docker-compose. So I can see the logs in the console. Then I create a new image which is detected by watchtower and it stops, remove, and pull the new image for my nodejs container; and start a new container. After that, for a little while, I can see logs from my nodejs container in the same console as before but out of the blue, the message Error grabbing logs: unexpected EOF
I tried to use the image containrrr/watchtower but I still have the error message Error grabbing logs: unexpected EOF that appeared after a few minutes. Before re-creating the container with the new image, it run for more than 5 hours without any issue. The new image did not add anything new (I just added a comment in the code to create a new build) so it’s not related to the update of the content
Beta Was this translation helpful? Give feedback.
Источник
Error when using docker tail -f with a lot of output #5156
Comments
- I have tried with the latest version of my channel (Stable or Edge)
- I have uploaded Diagnostics
- Diagnostics ID:
Expected behavior
docker tail -f doesn’t fail.
Actual behavior
docker tail -f fails with:
Information
This problem is reproducible for me. Unfortunately I cannot share a reproduction case, since the containers in question are internal.
However, the following reproduces 100%, and I assume is the same issue:
- Docker version: 3.0.1
- macOS Version: 10.15.7
Diagnostic logs
I cannot include the diagnostic logs, as they are full of PII. If really needed, please let me know a specific person that can look at them, and I will share them with that person.
Steps to reproduce the behavior
- docker logs —follow $(docker run —rm —detach alpine yes <1..200>; sleep 1) > /dev/null
The text was updated successfully, but these errors were encountered:
Issues go stale after 90 days of inactivity.
Mark the issue as fresh with /remove-lifecycle stale comment.
Stale issues will be closed after an additional 30 days of inactivity.
Prevent issues from auto-closing with an /lifecycle frozen comment.
If this issue is safe to close now please do so.
Send feedback to Docker Community Slack channels #docker-for-mac or #docker-for-windows.
/lifecycle stale
Источник
Error accessing logs after restarting server #2898
Comments
I restarted my server and now I can not access the application logs.
Apparently my application is working.
$ dokku logs app_name -t
error from daemon in stream: Error grabbing logs: EOF
Dokku version: 0.10.4
The text was updated successfully, but these errors were encountered:
Can you run the following:
Run the following:
docker logs -t —follow —tail 100 381bb80bed85596eb1f642669bc005666e17766bbd7d8724bfb96d2558cf1676
Sounds like a docker bug, I would file it with them. Sorry.
Oh, okay @josegonzalez. I’ll make a backup of the database and my application and reinstall everything.
Thanks for the fast support!!
You can try to just rebuild the app, which should «fix» the container by replacing it:
For now, apparently, the app is working properly.
I’ve run this command before.
Can this bug be solved soon? Or should I backup and reinstall everything?
Thats literally a docker bug. We don’t maintain docker, just use it. If the docker daemon is responding with that bug, you will need to report it to them and figure out what the issue is upstream.
If the ps:rebuild of your app doesn’t make the logs command work, then I’d say something is wrong with the daemon and would defer to what the docker folks say.
After spending some time upgrading and downgrading dokku and docker-ce packages on Ubuntu server, it looks like it’s an issue with dokku>=0.10.4 only dokku=0.10.3 working for me.
If anyone else getting the same issue, this solved it for me:
@DavidLemayian can you open a separate issue as to what you’re seeing and why you think this is an issue with Dokku? Thanks.
Footer
© 2023 GitHub, Inc.
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.
Источник
Error accessing logs after restarting server #2898
Comments
I restarted my server and now I can not access the application logs.
Apparently my application is working.
$ dokku logs app_name -t
error from daemon in stream: Error grabbing logs: EOF
Dokku version: 0.10.4
The text was updated successfully, but these errors were encountered:
Can you run the following:
Run the following:
docker logs -t —follow —tail 100 381bb80bed85596eb1f642669bc005666e17766bbd7d8724bfb96d2558cf1676
Sounds like a docker bug, I would file it with them. Sorry.
Oh, okay @josegonzalez. I’ll make a backup of the database and my application and reinstall everything.
Thanks for the fast support!!
You can try to just rebuild the app, which should «fix» the container by replacing it:
For now, apparently, the app is working properly.
I’ve run this command before.
Can this bug be solved soon? Or should I backup and reinstall everything?
Thats literally a docker bug. We don’t maintain docker, just use it. If the docker daemon is responding with that bug, you will need to report it to them and figure out what the issue is upstream.
If the ps:rebuild of your app doesn’t make the logs command work, then I’d say something is wrong with the daemon and would defer to what the docker folks say.
After spending some time upgrading and downgrading dokku and docker-ce packages on Ubuntu server, it looks like it’s an issue with dokku>=0.10.4 only dokku=0.10.3 working for me.
If anyone else getting the same issue, this solved it for me:
@DavidLemayian can you open a separate issue as to what you’re seeing and why you think this is an issue with Dokku? Thanks.
Footer
© 2023 GitHub, Inc.
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.
Источник
I am using git version 2.11.0.windows.3 on Windows 10. I can checkout, switch branches, commit, etc., but if I try something like git log I get:
'less: -c: line 0: unexpected EOF while looking for matching `''
'less: -c: line 1: syntax error: unexpected end of file
Is this a configuration issue? What steps should I take to resolve it?
Thanks and regards…Paul
asked Aug 26, 2017 at 16:31
6
For testing, try and unzip PortableGit-2.14.1-64-bit.7z.exe in (for instance) C:git2.14.1
.
Then, in a CMD shell session (not bash), type:
set PATH=C:WINDOWSsystem32;C:WINDOWS;C:WINDOWSSystem32Wbem;C:WINDOWSSystem32WindowsPowerShellv1.0
set GH=C:git2.14.1
set PATH=%GH%bin;%GH%usrbin;%GH%mingw64bin;%PATH%
In that session, your PATH will only reference Windows and Git 2.14.1.
Try again a Git clone, and your Git commands (like git log
), to see if the issue persists.
If it does, as the OP comment, then Windows networking is at fault.
answered Aug 27, 2017 at 4:08
VonCVonC
1.2m508 gold badges4248 silver badges5069 bronze badges
2
Thanks Lasse.
You were quite correct, less.exe
was in C:Program FilesGitusrbin
but unfortunately that directory wasn’t on my search path. I added the directory to my search path and all now works fine.
Best regards…Paul
answered Aug 29, 2017 at 8:27
Description
Our E2E test suite uses testcontainers-java to run our microservices and their dependencies in containers for the duration of our tests. All of the tests were passing with 19.03.14 until we updated our build nodes to Docker 20.10.1, at which point we started repeatedly getting STDOUT: $Error grabbing logs: unexpected EOF errors
, and our Wait.forLogMessage calls started timing out.
Note however, that this issue seems sporadic as about 1 out of 10 builds still passes. After we reverted to Docker 19.03.14 the issue went away. We’re using the latest version of Testcontainers (1.15.1 at the time of reporting the issue).
After contacting the developers I was told this is most likely a Docker issue.
Steps to reproduce the issue:
Unfortunately our projects are not OSS, so I cannot give you the exact containers used. I’ll try to describe a matching scenario.
- Set up a project that uses the latest version of testcontainers-java (
1.15.1
). - Set up a docker image that produces a lot of standard output.
- Start the image using testcontainers-java and wait for a log message using
Wait.forLogMessage()
. - A huge percentage of the times this will result in the error message
STDOUT: $Error grabbing logs: unexpected EOF errors
and the wait policy will not trigger even though the messages are present in the log.
Describe the results you received:
Error message: STDOUT: $Error grabbing logs: unexpected EOF errors
, wait policy for log message not triggering even though the message was present in the log.
Describe the results you expected:
No EOF error, wait policy for log message working.
Additional information you deem important (e.g. issue happens only occasionally):
As mentioned in the description the issue seems sporadic, but it happens in about 80+% of our CI runs.
Output of docker version
:
Previous version where the tests were passing:
Client: Docker Engine - Community
Version: 19.03.14
API version: 1.40
Go version: go1.13.15
Git commit: 5eb3275d40
Built: Tue Dec 1 19:20:26 2020
OS/Arch: linux/amd64
Experimental: false
Server: Docker Engine - Community
Engine:
Version: 19.03.14
API version: 1.40 (minimum version 1.12)
Go version: go1.13.15
Git commit: 5eb3275d40
Built: Tue Dec 1 19:18:53 2020
OS/Arch: linux/amd64
Experimental: false
containerd:
Version: 1.3.9
GitCommit: ea765aba0d05254012b0b9e595e995c09186427f
runc:
Version: 1.0.0-rc10
GitCommit: dc9208a3303feef5b3839f4323d9beb36df0a9dd
docker-init:
Version: 0.18.0
GitCommit: fec3683
Current version where the issue is present:
Client:
Version: 20.10.1
API version: 1.41
Go version: go1.15.6
Git commit: 831ebeae96
Built: Tue Dec 15 22:25:01 2020
OS/Arch: linux/amd64
Context: default
Experimental: true
Server:
Engine:
Version: 20.10.1
API version: 1.41 (minimum version 1.12)
Go version: go1.15.6
Git commit: f0014860c1
Built: Tue Dec 15 22:24:28 2020
OS/Arch: linux/amd64
Experimental: false
containerd:
Version: v1.4.3
GitCommit: 269548fa27e0089a8b8278fc4fc781d7f65a939b.m
runc:
Version: 1.0.0-rc92
GitCommit: ff819c7e9184c13b7c2607fe6c30ae19403a7aff
docker-init:
Version: 0.19.0
GitCommit: de40ad0
Output of docker info
:
Previous version where the tests were passing:
Client:
Debug Mode: false
Server:
Containers: 0
Running: 0
Paused: 0
Stopped: 0
Images: 92
Server Version: 19.03.14
Storage Driver: overlay2
Backing Filesystem: extfs
Supports d_type: true
Native Overlay Diff: true
Logging Driver: json-file
Cgroup Driver: cgroupfs
Plugins:
Volume: local
Network: bridge host ipvlan macvlan null overlay
Log: awslogs fluentd gcplogs gelf journald json-file local logentries splunk syslog
Swarm: inactive
Runtimes: runc
Default Runtime: runc
Init Binary: docker-init
containerd version: ea765aba0d05254012b0b9e595e995c09186427f
runc version: dc9208a3303feef5b3839f4323d9beb36df0a9dd
init version: fec3683
Security Options:
apparmor
seccomp
Profile: default
Kernel Version: 5.4.0-58-generic
Operating System: Ubuntu 20.04.1 LTS
OSType: linux
Architecture: x86_64
CPUs: 3
Total Memory: 15.64GiB
Name: build1
ID: QWYR:EE5C:DWTE:MY65:MQ7Y:FERG:F7J2:IDTT:7LVR:VHSE:REFY:6AQH
Docker Root Dir: /var/lib/docker
Debug Mode: false
Registry: https://index.docker.io/v1/
Labels:
Experimental: false
Insecure Registries:
127.0.0.0/8
Live Restore Enabled: false
WARNING: No swap limit support
Current version where the issue is present:
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-tp-docker)
Server:
Containers: 134
Running: 8
Paused: 0
Stopped: 126
Images: 1390
Server Version: 20.10.1
Storage Driver: overlay2
Backing Filesystem: extfs
Supports d_type: true
Native Overlay Diff: false
Logging Driver: json-file
Cgroup Driver: cgroupfs
Cgroup Version: 1
Plugins:
Volume: local
Network: bridge host ipvlan macvlan null overlay
Log: awslogs fluentd gcplogs gelf journald json-file local logentries splunk syslog
Swarm: inactive
Runtimes: io.containerd.runc.v2 io.containerd.runtime.v1.linux runc
Default Runtime: runc
Init Binary: docker-init
containerd version: 269548fa27e0089a8b8278fc4fc781d7f65a939b.m
runc version: ff819c7e9184c13b7c2607fe6c30ae19403a7aff
init version: de40ad0
Security Options:
seccomp
Profile: default
Kernel Version: 5.9.14-arch1-1
Operating System: Arch Linux
OSType: linux
Architecture: x86_64
CPUs: 8
Total Memory: 31.24GiB
Name: RE02WL03
ID: YC3H:JCWA:APFN:VOQ7:CWPG:B4VO:5FYW:UPVL:2H5B:PO4H:SXO7:LSGH
Docker Root Dir: /var/lib/docker
Debug Mode: false
Registry: https://index.docker.io/v1/
Labels:
Experimental: false
Insecure Registries:
127.0.0.0/8
Live Restore Enabled: false
WARNING: No blkio weight support
WARNING: No blkio weight_device support
The current version and info parts were copied from an Arch box, while the previous version and info parts were copied from an Ubuntu box, but we could also reproduce the issue on Ubuntu after upgrading to 20.10.
Additional environment details (AWS, VirtualBox, physical, etc.):
- Could reproduce using both Ubuntu 20.10 and Arch Linux.
Всем привет.
Скрипт должен создать логин и пароль пользователя на удаленном компе, но при запуске скрипта появляются ошибки:
[lnxcfg@centos-2gb-nbg-vpn ~]$ ssh root@centos-2gb-nbg1-webserver 'bash -s' < setup-lnxcfg-user
root@centos-2gb-nbg1-webserver's password:
bash: line 5: $'r': command not found
bash: line 53: warning: here-document at line 23 delimited by end-of-file (wanted `EOF')
bash: line 54: syntax error: unexpected end of file
Сам скрипт:
#!/bin/bash
# setup-lnxcfg-user
# create lnxcfg user for Ansible automation
# and configuration management
# create lnxcfg user
getentUser=$(/usr/bin/getent passwd lnxcfg)
if [ -z "$getentUser" ]
then
echo "User lnxcfg does not exist. Will Add..."
/usr/sbin/groupadd -g 2002 lnxcfg
/usr/sbin/useradd -u 2002 -g 2002 -c "Ansible Automation Account" -s /bin/bash -m -d /home/lnxcfg lnxcfg
echo "lnxcfg:5555555555" | /usr/sbin/chpasswd
mkdir -p /home/lnxcfg/.ssh
fi
# setup ssh authorization keys for Ansible access
echo "setting up ssh authorization keys..."
cat << 'EOF' >> /home/lnxcfg/.ssh/authorized_keys
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQC8qmzR/QSI1VYhv4iPpCxmIvHBP4X6pvk2UfX3mepgaEtobkTyM2RiNrqf22dpcY/f lnxcfg@centos-2gb-nbg-vpn
EOF
chown -R lnxcfg:lnxcfg /home/lnxcfg/.ssh
chmod 700 /home/lnxcfg/.ssh
# setup sudo access for Ansible
if [ ! -s /etc/sudoers.d/lnxcfg ]
then
echo "User lnxcfg sudoers does not exist. Will Add..."
cat << 'EOF' > /etc/sudoers.d/lnxcfg
User_Alias ANSIBLE_AUTOMATION = lnxcfg
ANSIBLE_AUTOMATION ALL=(ALL) NOPASSWD: ALL
EOF
chmod 400 /etc/sudoers.d/lnxcfg
fi
# disable login for lnxcfg except through
# ssh keys
cat << 'EOF' >> /etc/ssh/sshd_config
Match User lnxcfg
PasswordAuthentication no
AuthenticationMethods publickey
EOF
# restart sshd
systemctl restart sshd
# end of script
Если что, то вот оригинал статьи https://medium.com/@brad.simonin/learning-ansible-…
Deploying old fashion way
When developing web apps sooner or later you need to handle the deployment of your app. A web server is needed to run your app so you need to install one which in some case needs deep knowledge about the one you go for.
In the case of java web apps, like Magnolia CMS, there are hundreds of options to choose from. In this post we will use Tomcat to deploy Magnolia.
Why Tomcat?
Tomcat is a good candidate since its very well adopted by the java community and its a good compromise between its feature set and its low complexity (it doesn’t support EARs for example).
The idea of downloading, installing and configuring Tomcat over and over again every time you want to deploy and run your app can be cumbersome and tiring. Specially when you also have to install a database and/or want to take advantage of cloud platforms and services.
Deploying container way
This is where containers like Docker can be helpful since the only thing you need to do is run a Tomcat image and then copy your WAR file there and you are ready to go. Any OS, library, tool, JDK, etc has been already handled and set-up for you. And on top of that you can move your environment to any cloud platform and it will run just as smooth as in your on-premise/local one.
In the case of Magnolia, there are a couple of images out there already available. None of them is official and are somehow outdated. In this post, I will try to build yet another one, from scratch, so anyone can do the same with their own flavours of OS, server and deployment configuration.
Base image
The first step is to choose a base image with tomcat already installed and ready to deploy your web app. There are many images available in Docker Hub, including the official ones.
Just for fun (and also to feel a bit more in control of the environment) let’s pick an OpenJDK image based on Debian slim version.
Why the slim version?
The idea of docker containers is to provide the minimal resources needed for a service in particular, so for Magnolia this would mean the minimum required to run Tomcat and deploy Magnolia on it. Debian has been experimenting with «providing a slimmer base (removing some extra files that are normally not necessary within containers, such as man pages and documentation)»
Why Debian?
Actually my first attempt was to use an alpine linux image with OpenJDK but I stumbled upon some issues with glib libraries that were needed by Magnolia. Apparently there is a workaround in case someone one wants to experiment with it
Regarding Debian, is widely used in docker images and in general, so it’s a safe bet.
Base Dockerfile
In docker, you need a dockerfile in order to build and run a container. The dockerfile is a way to describe all the things needed to create and run a container which provides a service.
I created a dockerfile based on openjdk 8 since its the minimum required by Magnolia, and then I just downloaded Tomcat, installed it and exposed port 8080. You can check the image at docker hub with the name: ebguilbert/tomcat-slim.
Note: I updated the dockerfile to use openjdk 11. But you can always checkout the previous commit.
Magnolia Container
Defining the image
Once we have our base image with an OS, JDK and Tomcat already set-up, the only thing needed is to copy a Magnolia war file and Tomcat will automatically deploy it.
This might seem like a simple step but in fact there are a couple of things you want to take care of when creating your own Magnolia Docker image:
The base image
Taken from the previous section, lets use ebguilbert/tomcat-slim:9 (9 is the tag stands for Tomcat 9.0.54 build)
FROM ebguilbert/tomcat-slim:9
Env variables
Environment variables are usually a good practice since they keep things organised in your dockerfile so anyone can check and modify relevant configuration at a glance. It’s important to note that these variables will also be present in the running OS of the container so anyone can check them out by inspecting the image or by shell commands.
The first two variables are the version and the server to download the war from. These variables are only relevant for using a standard bundle, probably just for light development. In case you are building your own war, they are not needed anymore.
ENV MGNL_VERSION 6.2
ENV MGNL_SERVER https://files.magnolia-cms.com
Note: The version should be updated to the latest one, i.e 6.2.x, the URL (files.magnolia-cms.com) is only accesible for the latest version.
The following variables are very important, first the app main configuration folder, then the JCR repositories folder, logs folder and lastly the light-modules folder.
ENV MGNL_APP_DIR /opt/magnolia
ENV MGNL_REPOSITORIES_DIR ${MGNL_APP_DIR}/repositories
ENV MGNL_LOGS_DIR ${MGNL_APP_DIR}/logs
ENV MGNL_RESOURCES_DIR ${MGNL_APP_DIR}/light-modules
Arguments
Env variables are part of the image and can’t be changed outside the dockerfile. But, if you define your variables as arguments you could change them at building time, which means the same dockerfile can be used for different configurations/builds.
Let’s define the type of instance, the name of the war to be downloaded and the heap memory as arguments. We will see in the next section how we could use them to build different images.
ARG MGNL_AUTHOR=true
ARG MGNL_WAR=magnolia-dx-core-webapp
ARG MGNL_HEAP=2048M
JVM args
Since we are building a Java environment, it is very relevant to specify the heap memory that Tomcat should use to run our app. In this case we are using 2GB (minimum required by Magnolia). The other arguments are just the env/arg variables described previously.
ENV CATALINA_OPTS -Xms64M -Xmx${MGNL_HEAP} -Djava.awt.headless=true
-Dmagnolia.bootstrap.authorInstance=${MGNL_AUTHOR}
-Dmagnolia.repositories.home=${MGNL_REPOSITORIES_DIR}
-Dmagnolia.author.key.location=${MGNL_APP_DIR}/magnolia-activation-keypair.properties
-Dmagnolia.logs.dir=${MGNL_LOGS_DIR}
-Dmagnolia.resources.dir=${MGNL_RESOURCES_DIR}
-Dmagnolia.update.auto=true
Volume
Volumes are a way to share files between the host and the container. Without volumes, whatever you store in your container will be lost when you stop it. In the case of Magnolia we need to persist in the host machine the app folder since it will contain configurations like private/public keys, indexes, logs and the file-based contents.
VOLUME [ «${MGNL_APP_DIR}« ]
The war file to deploy
The final step is to obtain and copy the war file into the Tomcat’s webapp folder so it’s deployed when the container is started.
RUN wget -q ${MGNL_SERVER}/${MGNL_WAR}—${MGNL_VERSION}.war -O ${DEPLOYMENT_DIR}/ROOT.war
Like I said before I am using a standard bundle downloaded from Magnolia servers. But if you are providing your own war file you might need to change it to something like:
COPY my-application.war $DEPLOYMENT_DIR
It’s also worth noticing that if you want to use the community standard bundle you will need to change the MGNL_SERVER and MGNL_WAR variables.
Note: If you use https://files.magnolia-cms.com URL and the certificate is invalid, wget will fail. In order to prevent that, try adding —no-check-certificate parameter to wget command
Building the image
In Magnolia you usually need at least one author and one public instance, so let’s build an image for each:
docker build -t ebguilbert/magnolia-cms:6.2-author —build-arg MGNL_AUTHOR=true .
docker build -t ebguilbert/magnolia-cms:6.2-public —build-arg MGNL_AUTHOR=false .
Running the image
Managing volumes
Before running the image we need to create a volume in the host for each instance/container. In Magnolia you usually need at least one author and one public instance, so let’s create one volume for each:
docker volume create mgnlauthor
docker volume create mgnlpublic
Managing network
A network is needed since the author instance needs to communicate to public instances for publication of content. If you don’t provide any network when running the images, they will be in the default bridge network where both of them will be assigned dynamic IPs and they could be connected by IP. But this is not the desired way since we can’t know the IP being assigned to each container (without inspecting the container with docker inspect).
For easy connection we will need to assign network aliases to the containers. In order to do that we will create our own network providing an ip range so they are isolated from other containers:
docker network create —subnet=192.168.42.0/24 mgnlnet
Running containers
We are finally ready to run our author and public containers, using our volumes and network:
docker run —rm -d -p 8080:8080/tcp —mount source=mgnlauthor,target=/opt/magnolia
—network mgnlnet —name mgnlauthor ebguilbert/magnolia-cms:6.2-author
docker run —rm -d -p 8090:8080/tcp —mount source=mgnlpublic,target=/opt/magnolia
—network mgnlnet —name mgnlpublic ebguilbert/magnolia-cms:6.2-public
Lets take a moment to review all the options provided:
- Internally the containers are exposing port 8080, but the author is using port 8080 on the host and the public is using 8090. You can assign any port you like as the first parameter.
- The volumes on the host will be linked to /opt/magnolia in the container.
- Network mgnlnet is used by both containers where the author is called mgnlauthor and public is mgnlpublic.
Publishing content
Final step for a working Magnolia installation would be to configure the public instance as a receiver in the author instance. For that we will make use of the aliases provided in the network, let’s configure the receiver in the publishing-core module of the author instance:
* publishing-core
* config
* receivers
* mgnlpublic
Notice we are using the container port and not the host one.
Final Dockerfile
FROM ebguilbert/tomcat-slim:9
LABEL maintainer=«Edwin Guilbert»
# ENV variables for Magnolia
ENV MGNL_VERSION 6.2
ENV MGNL_SERVER https://files.magnolia-cms.com
ENV MGNL_APP_DIR /opt/magnolia
ENV MGNL_REPOSITORIES_DIR ${MGNL_APP_DIR}/repositories
ENV MGNL_LOGS_DIR ${MGNL_APP_DIR}/logs
ENV MGNL_RESOURCES_DIR ${MGNL_APP_DIR}/light-modules
# ARGS
ARG MGNL_AUTHOR=true
ARG MGNL_WAR=magnolia-dx-core-webapp
ARG MGNL_HEAP=2048M
# JVM PARAMS
ENV CATALINA_OPTS -Xms64M -Xmx${MGNL_HEAP} -Djava.awt.headless=true
-Dmagnolia.bootstrap.authorInstance=${MGNL_AUTHOR}
-Dmagnolia.repositories.home=${MGNL_REPOSITORIES_DIR}
-Dmagnolia.author.key.location=${MGNL_APP_DIR}/magnolia-activation-keypair.properties
-Dmagnolia.logs.dir=${MGNL_LOGS_DIR}
-Dmagnolia.resources.dir=${MGNL_RESOURCES_DIR}
-Dmagnolia.update.auto=true
# VOLUME for Magnolia
VOLUME [ «${MGNL_APP_DIR}« ]
RUN wget -q ${MGNL_SERVER}/${MGNL_WAR}—${MGNL_VERSION}.war -O ${DEPLOYMENT_DIR}/ROOT.war
Note: The version of Magnolia should be updated to the latest one, i.e 6.2.x, the URL (files.magnolia-cms.com) is only accesible for the latest version. Also if the URL’s certificate is invalid, try adding —no-check-certificate to wget.
Database
Since this post ended up quite long already, let’s talk about best practices for configuring a dockerized database in the next post.
UNEXPECTED EOF FOR DOCKER LOGIN OR DOCKER PULL : R/DOCKER — REDDIT
Unexpected EOF for Docker Login or Docker Pull Hi there, I have been running a private docker registry on Ubuntu 18.04. TLS enabled with a self-signed certificate and using a custon …
From reddit.com
SYNTAXERROR: UNEXPECTED EOF WHILE PARSING — STACK OVERFLOW
The SyntaxError: unexpected EOF while parsing means that the end of your source code was reached before all code blocks were completed. A code block starts with a statement like for i …
From stackoverflow.com
UNEXPECTED EOF ERROR WHILE BUILDING AND LOGIN
Dec 6, 2021 Hi all, that’s probably the first time in my life, that nobody else had the same issue :slight_smile: While building a small app in GO i am getting all the time following errors: => …
From forums.docker.com
ERROR UNABLE TO STREAM THE BUILD LOGS CAUSED BY UNEXPECTED EOF …
Red Hat Customer Portal — Access to 24×7 support and knowledge. Get product support and knowledge from the open source experts. Read developer tutorials and download Red Hat …
From access.redhat.com
AN EASY WAY TO FIGURE OUT WHY A DOCKER CONTAINER KEEP RESTARTING
Dec 15, 2018 3 Answers Sorted by: 4 Don’t use «docker logs». Use «docker-compose logs flask» to see the logs of that restarting containers. With your options: docker-compose logs -f — …
From stackoverflow.com
ERROR GRABBING LOGS: EOF WHEN TAILING CONTAINER LOGS …
Nov 1, 2017 Description Seem to be having issues tailing logs after upgrading to 17.09.0-ce. Was working on 17.06.0-ce Steps to reproduce the issue: Create container Start container Tail …
From github.com
HOW TO SOLVE THE UNEXPECTED <EOF> SYNTAX ERROR IN SNOWFLAKE
Dec 2, 2022 An unexpected ‘<EOF>’ syntax error in Snowflake simply means that your SQL compiler has hit an obstacle in parsing your code. Specifically, while processing said code, …
From getcensus.com
DOCKER: ERROR GRABBING LOGS: INVALID CHARACTER ‘X00’ …
Oct 19, 2017 4 Answers Sorted by: 18 simply remove the ~/.docker/ directory Share Follow answered Sep 29, 2020 at 16:42 soufiane ELAMMARI 697 5 12 3 Splendid, I had this …
From stackoverflow.com
[SOLVED] LOGCAT CRASHES WITH ERROR: UNEXPECTED EOF
Dec 31, 2021 Logcat crashes with error: unexpected EOF android android-logcat 64,267 Solution 1 Try setting Logger buffer sizes to off under Settings->Developer options, on your …
From 9to5answer.com
ERROR GRABBING LOGS: UNEXPECTED EOF #913 — GITHUB
Apr 14, 2021 If the container is recreated, it will indeed break the connection to the log stream for docker-compose and discard any prior logs available through docker logs. This is …
From github.com
ERROR FROM DAEMON IN STREAM: ERROR GRABBING LOGS: …
Mar 22, 2021 [Mar 23 2021 05:49:29.611] [INFO] [Enclave] Seal random data -> a24846d988da85ce266f9bc62d4db20a526971f1f660234b18feff0b2e6f2a01, 6593G success
From github.com
ERROR GRABBING LOGS: UNEXPECTED EOF #913 — GITHUB
Apr 14, 2021 Try using the latest version, containrrr/watchtower (v2tec/watchtower is the abandoned project that containrrr adopted). I don’t know if there are any differences in logging …
From github.com
ERROR GRABBING LOGS: EOF · ISSUE #1235 · DOCKER/FOR-WIN · …
Oct 23, 2017 Error grabbing logs: EOF · Issue #1235 · docker/for-win · GitHub docker / for-win Public Notifications Fork 292 Star 1.7k Code Issues 352 Pull requests Actions Projects …
From github.com
ERROR GRABBING LOGS: UNEXPECTED EOF #898 — GITHUB
Apr 14, 2021 Error grabbing logs: unexpected EOF · Issue #898 · containrrr/watchtower · GitHub containrrr / watchtower Public Notifications Fork 684 Star 12.6k Code Issues 61 Pull …
From github.com
NEW TO DOCKER — NEED HELP RUNNING HAUGENE/TRANSMISSION …
The Error grabbing logs: EOFmessage does not says much. You can try starting the container without the -dparameter (this will not run the container in the background, but shows all output …
From reddit.com
[SOLVED] DOCKER: ERROR GRABBING LOGS: INVALID CHARACTER | 9TO5ANSWER
Jun 12, 2022 Containers: 11 Running: 11 Paused: 0 Stopped: 0 Images: 8 Server Version: 17.09.0-ce Storage Driver: aufs Root Dir: /var/lib/docker/aufs Backing Filesystem: extfs Dirs: …
From 9to5answer.com
OPENSSL: ERROR:0A000126:SSL ROUTINES::UNEXPECTED EOF WHILE READING
Jul 12, 2022 OpenSSL: error:0A000126:SSL routines::unexpected eof while reading Unable to establish SSL connection. As per other stack overflow posts, I’ve tried: Updating my packges …
From stackoverflow.com
`DOCKER LOGS -F -T` FAILS WITH `ERROR GRABBING LOGS: …
Dec 16, 2020 New issue docker logs -f -t fails with Error grabbing logs: unexpected EOF after about 30m #5145 Closed jamshid opened this issue on Dec 16, 2020 · 12 comments jamshid commented on Dec 16, 2020 • edited [ X ] I have tried with the latest version of my channel …
From github.com