mirror of
https://github.com/asciinema/asciinema.git
synced 2026-04-24 23:45:50 +03:00
[GH-ISSUE #202] asciinema rec doesn't work in a Docker container #147
Labels
No labels
bug
compatibility
feature request
fit for beginners
help wanted
hosting
idea
improvement
packaging
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/asciinema#147
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @philippgille on GitHub (Apr 1, 2017).
Original GitHub issue: https://github.com/asciinema/asciinema/issues/202
asciinema recdoesn't work in a Docker container. Probably due to the Dockter container TTY being "pseudo"?Reproduce:
docker run -it ubuntu:16.04 bashapt update && apt upgrade -yapt install asciinema -yasciinema rec@ku1ik commented on GitHub (Apr 5, 2017):
It expects
SHELLenv var. You can try:env SHELL=/bin/sh asciinema rec.Btw, this
0.9.8version of asciinema is over 2 years old. I suggest installing the latest one: https://asciinema.org/docs/installation@philippgille commented on GitHub (Apr 5, 2017):
I had been on that website, but I used the command listed for Debian instead of Ubuntu.
For Ubuntu, in the Docker container, I additionally had to
apt-get install software-properties-commonbefore being able toapt-add-repository ppa:zanchey/asciinema. Now it shows version1.3.0-1.But now, when I do
asciinema recit shows:echo $SHELLshows/bin/bash.env SHELL=/bin/sh asciinema recleads to the same error.On Stackoverflow I found a question regarding the error and tried
apt-get install --reinstall python-pkg-resources, but it didn't help. Another answer to that question suggestedpip install --upgrade setuptools, where I had toapt-get install python-pipbefore. Still the same error.Another answer suggested
apt-get install python3-setuptools.Now, finally
asciinema recgave me different ouput:asciinema needs a UTF-8 native locale to run. Check the output oflocalecommand.. Typically a fresh Ubuntu container doesn't have any locales set up. So I didlocale-gen en_US.UTF-8andexport LANG=en_US.UTF-8andexport LANGUAGE=en_US:enandexport LC_ALL=en_US.UTF-8(maybe in a different order).And that fixed it for me. I can now
asciinema rec!You might want to prevent other Docker users to go through this, so maybe the installer can be improved regarding the
No module named 'pkg_resources'issue, or you could add a Ubuntu Docker container section on your Installation page.@ku1ik commented on GitHub (Apr 11, 2017):
Kudos for figuring this all out! I'm not sure how many people record from within containers, but let's just leave this issue open and see if/how many people come here.
I'm also thinking about creating official asciinema cli container. Once we have that, we can add Docker section to README, also explaining what's needed when you're manually installing asciinema inside of a container.
@evertramos commented on GitHub (Aug 23, 2017):
I have this container as a test:
It's working for me.
@philippgille commented on GitHub (Aug 28, 2017):
I don't think that's a valid, working Dockerfile. It's using
wget, butwgetisn't part ofubuntu:16.04and it's not being installed either.docker build -t local/asciinema-test .with that Dockerfile leads to:As expected.
Also I would combine the first two
RUNcommands, otherwiseapt-get update, thenrm -rf /var/lib/apt/lists/*and thenapt-get updateagain leads to unnecessary overhead.And installing
asciinemafrom the Ubuntu package repository isn't necessary when overwriting it with the version from GitHub anyway.So, trying with this improved Dockerfile:
That worked for me.
Thanks for the hints though @evertramos!
Also, in case you're already inside an existing container and you want to record something, the steps are similar to the Dockerfile:
Also please also be aware of the official documentation: https://asciinema.org/docs/installation#running-in-docker-container
That documentation didn't exist when I opened this issue. I'd recommend to stick to the official Docker image.
Regarding this ticket: I think it can be closed.