Giter Site home page Giter Site logo

critmux's Introduction

Freeze. Thaw. Repeat.

This is a tech demo of CRIU and Docker integration, featuring tmux.

See it live in this ASCII video demo!

  1. docker run -t -i --privileged --name critmux jpetazzo/critmux
  2. Do stuff in tmux. Don't know what to do? Just type a few characters.
  3. From another terminal, docker stop critmux. Container stops.
  4. docker start critmux ; docker attach critmux. MIND. BLOWN.

Note: docker start -a doesn't quite work.

What the?

This container starts a little wrapper, which sets up a SIGTERM signal handler. Then it checks if there is some saved state in /state:

  • if there is no saved state, we assume a clean start, setup a tmux session, and attach to it;
  • if there is a saved state, it is restored it (it should be a tmux daemon process), then we attach to tmux.

The signal handler just sends a detach command to tmux; and the wrapper arranges for the state to be saved when tmux is detached. In other words, when detaching from tmux, or when sending SIGTERM, or when doing docker stop on the container, we end up saving its state.

Requirements

You need a fairly recent kernel. Debian's 3.14 works; some people reported that 3.13 didn't.

AUFS won't work.

critmux's People

Contributors

jpetazzo avatar

Stargazers

 avatar Adham Elaraby avatar  avatar Brandon Carter avatar Craig M avatar  avatar sugarfillet avatar Pratham avatar  avatar Matt Robinson avatar Theo Walker avatar Huan Xu avatar Keyvan Fatehi avatar Andy Mroczkowski avatar  avatar Daniel Bodnar avatar Liu Yufei avatar Daniel L Morris avatar  avatar ナッティ avatar Alejandro Gonzalez Araya avatar Michel Pelletier avatar 孟一凡 avatar Jeff Billimek avatar david watson avatar Thomas Friedel avatar Ryan Bertsche avatar Shohei Kameda avatar ns avatar Matt Sparks avatar Michael Ayoub avatar Ertuğrul Erata avatar ik5 avatar Adam Hanna avatar Tsunemichi Harada avatar Zicklag avatar  avatar George Erickson avatar Tim Green avatar Ilya Pikulin avatar Mark Janssen avatar Timothy Chklovski avatar Denis Denisov avatar Nikolay Kolev avatar Christoph Grabo avatar Philipp Schmitt avatar Vizi György Tamás avatar Dharmesh Kakadia avatar Justin Garrison avatar Davi Marcondes Moreira avatar Ondrej Galbavy avatar Roland Urbano avatar Yuriy Grechanyi avatar Walt Woods avatar Łukasz Adamczewski avatar  avatar Davide Faconti avatar Emanuele Mazzotta avatar Anhad Jai Singh avatar Jimmy Song avatar Adigo avatar RajaniKanth Reddy avatar  avatar Mike Groseclose avatar 曹文忠 avatar Drew Nall avatar Brandon Zylstra avatar Xendarboh Sensorii avatar Markus Kohler avatar  avatar Naru avatar Angus H. avatar Vik Paruchuri avatar Filipe Esperandio (Pippo) avatar Jon Baer avatar Paul Brit avatar philipz avatar Alexander Pimenov avatar  avatar Sergey Bronnikov avatar Christer Sandberg avatar Massimo Santini avatar Marcell Mars avatar  avatar ahhdem avatar  avatar  avatar Pantelis Koukousoulas avatar Joao P Dubas avatar  avatar Simon Chow avatar Amy Tobey avatar Kenichi Takahashi avatar Deni Bertovic avatar Joe Rosato avatar Dongsu Jang avatar Aliaksandr Lomau avatar rojaro avatar Ryan Pardieck avatar Camilo Aguilar avatar

Watchers

Josh Moore avatar Manfred Touron avatar  avatar Alexander Pimenov avatar James Cloos avatar  avatar  avatar Craig M avatar

critmux's Issues

Can't dump tmux process

I followed your instruction and when I stopped the container, it fails to dump the tmux process with the following error.

Error (kerndat.c:44): Can't stat self map_files: No such file or directory
Error (cr-dump.c:1863): Dumping FAILED.
Traceback (most recent call last):
  File "/usr/local/sbin/wrapper", line 28, in <module>
    system("criu dump --tree {} --images-dir /state".format(pid))
  File "/usr/local/sbin/wrapper", line 9, in system
    return subprocess.check_call(cmd, shell=True)
  File "/usr/lib/python3.4/subprocess.py", line 557, in check_call
    raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command 'criu dump --tree 10 --images-dir /state' returned non-zero exit status 1

Apparently, map_files are missing on this image.

root@404b50795b6c:/src# find /proc/ | grep map_file

According to http://lwn.net/Articles/574918/ it seems the kernel is built without CONFIG_CHECKPOINT_RESTORE option.

But in your demo, it was certainly working. Does this still work for you?

Thanks.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.