├── .gitignore ├── LICENSE ├── README.md └── ubuntu-demo.sh /.gitignore: -------------------------------------------------------------------------------- 1 | .idea/ 2 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2017 Vlad Holubiev 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 |

2 | 3 | Docker in Lambda 4 | 5 |

6 | 7 |

8 | 9 | Read this blog post on Medium for details: How Did I “Hack” AWS Lambda to Run Docker Containers 10 | 11 |

12 | 13 | 14 | # Show me the code 15 | 16 | `ubuntu-demo.sh` script is in the repo. It will run an example command `cat /etc/os-release` which shows it's a real Ubuntu. 17 | 18 | How can I run it? 19 | 20 | If you want to use it in the project, just spawn a process with the script in any language you prefer. 21 | 22 | Or you can try it right away with [lambdash](https://github.com/alestic/lambdash): 23 | 24 | ```sh 25 | $ lambdash "export HO... # paste code below" 26 | ``` 27 | 28 | ## ubuntu-demo.sh 29 | 30 | ```sh 31 | export HOME=/tmp 32 | export UDOCKER_DIR=/tmp 33 | export UDOCKER_BIN=/tmp 34 | export UDOCKER_LIB=/tmp 35 | export UDOCKER_CONTAINERS=/tmp 36 | 37 | cd /tmp 38 | 39 | # Installation 40 | curl https://raw.githubusercontent.com/indigo-dc/udocker/udocker-fr/udocker.py > udocker 41 | python udocker version 42 | 43 | # Pull the image 44 | python udocker pull ubuntu:17.04 45 | 46 | # Setup a container 47 | python udocker create --name=ubuntu ubuntu:17.04 48 | python udocker setup --execmode=F1 ubuntu 49 | 50 | # Run it! 51 | python udocker run ubuntu cat /etc/os-release 52 | ``` 53 | 54 | ## Similar Projects 55 | 56 | Check out a bit more sophisticated project based on same ideas - [SCAR](https://github.com/grycap/scar). It wraps abovementioned commands into a framework shell, but not only. 57 | -------------------------------------------------------------------------------- /ubuntu-demo.sh: -------------------------------------------------------------------------------- 1 | export HOME=/tmp 2 | export UDOCKER_DIR=/tmp 3 | export UDOCKER_BIN=/tmp 4 | export UDOCKER_LIB=/tmp 5 | export UDOCKER_CONTAINERS=/tmp 6 | 7 | cd /tmp 8 | 9 | # Installation 10 | curl https://raw.githubusercontent.com/indigo-dc/udocker/udocker-fr/udocker.py > udocker 11 | python udocker version 12 | 13 | # Pull the image 14 | python udocker pull ubuntu:17.04 15 | 16 | # Setup a container 17 | python udocker create --name=ubuntu ubuntu:17.04 18 | python udocker setup --execmode=F1 ubuntu 19 | 20 | # Run it! 21 | python udocker run --nosysdirs ubuntu cat /etc/os-release 22 | --------------------------------------------------------------------------------