{"id":24761676,"url":"https://github.com/carlossanabriam/vagrant-docker-python3","last_synced_at":"2026-04-13T04:48:48.832Z","repository":{"id":222729678,"uuid":"554902387","full_name":"CarlosSanabriaM/vagrant-docker-python3","owner":"CarlosSanabriaM","description":"Project that automates the creation of a Python 3.10 + Jupyter local environment, meant to be used for learning and testing purposes.","archived":false,"fork":false,"pushed_at":"2024-11-10T21:12:20.000Z","size":399,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-23T13:16:03.446Z","etag":null,"topics":["docker","docker-compose","jupyter","python","vagrant"],"latest_commit_sha":null,"homepage":"","language":"Shell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/CarlosSanabriaM.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2022-10-20T15:42:26.000Z","updated_at":"2024-11-10T21:12:24.000Z","dependencies_parsed_at":"2024-11-10T22:30:09.981Z","dependency_job_id":null,"html_url":"https://github.com/CarlosSanabriaM/vagrant-docker-python3","commit_stats":null,"previous_names":["carlossanabriam/vagrant-docker-python3"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/CarlosSanabriaM/vagrant-docker-python3","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CarlosSanabriaM%2Fvagrant-docker-python3","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CarlosSanabriaM%2Fvagrant-docker-python3/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CarlosSanabriaM%2Fvagrant-docker-python3/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CarlosSanabriaM%2Fvagrant-docker-python3/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/CarlosSanabriaM","download_url":"https://codeload.github.com/CarlosSanabriaM/vagrant-docker-python3/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CarlosSanabriaM%2Fvagrant-docker-python3/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":260966765,"owners_count":23090091,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["docker","docker-compose","jupyter","python","vagrant"],"created_at":"2025-01-28T19:18:40.966Z","updated_at":"2026-04-13T04:48:43.800Z","avatar_url":"https://github.com/CarlosSanabriaM.png","language":"Shell","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Vagrant Docker Python3\n\n\u003e __⭐️ Local, automated and isolated environment for learning Python 3.__\n\nThis project __automates the creation of a `Python 3.10 + Jupyter` local environment__, meant to be used for __learning and testing__ purposes.\n\nIt creates a VM using [Vagrant](https://www.vagrantup.com/), that has [Docker](https://www.docker.com/)\nand [Docker Compose](https://docs.docker.com/compose/) installed.\n\nPython3 + Jupyter are installed and executed __inside a Docker container, inside the VM__.\n\n\u003e With this, __you don't need to install Docker or Python__ on your local computer.  \n\u003e __You just need to install Vagrant and VirtualBox__.\n\u003e\n\u003e All the images and containers are created in an __isolated environment__ that can be deleted at any time.\n\n## Architecture\n\nVagrant creates an Ubuntu VM that installs Docker, pulls Docker images from [DockerHub](https://hub.docker.com/),\nand runs containers with their corresponding port mappings.\n\nJupyter website will be accessible to the host's web browser through port `8888`.\n\nThe automation process is specified using the following files:\n1. `Vagrantfile`: Tells Vagrant how to create and configure the VM\n2. `docker-compose.yml`: Tells Docker Compose which and how containers should be executed\n\nThe following diagram shows the architecture:\n\n![Architecture diagram](docs/diagrams/architecture-diagram.png)\n\n## Prerequisites\n\n* [Install VirtualBox](https://www.virtualbox.org/wiki/Downloads)\n* [Install Vagrant](https://www.vagrantup.com/docs/installation)\n\n### Verify installation\n\n\u003e [!NOTE]  \n\u003e Execute these steps only if it's the first time that you use Vagrant with VirtualBox.  \n\u003e If not, you can skip them. They only serve to test the Vagrant + VirtualBox installation.  \n\u003e If Vagrant and VirtualBox are installed and configured correctly,\n\u003e then the environment will work fine (it has already been tested, and is repeatable).\n\nCheck that the `vagrant` executable was added correctly to the `PATH` variable:\n```bash\nvagrant version\n```\n\nCheck that vagrant is able to create a VM:\n```bash\nmkdir test-vagrant\ncd test-vagrant\nvagrant init ubuntu/jammy64\nvagrant up\nvagrant ssh\npwd\nexit\nvagrant destroy --force\ncd ..\nrm -rf test-vagrant\n```\n\n\u003e [!WARNING]  \n\u003e If the following error appears after executing `vagrant up`:  \n\u003e __`No usable default provider could be found for your system.`__\n\u003e\n\u003e 1. Verify that VirtualBox was installed correctly\n\u003e 2. Obtain more info about the error:\n\u003e    ```\n\u003e    vagrant up --provider=virtualbox\n\u003e    ```\n\n\u003e [!WARNING]  \n\u003e If the following error appears after executing `vagrant up`:  \n\u003e __`VBoxManage: error: Details: code NS_ERROR_FAILURE (0x80004005)`__\n\u003e\n\u003e * Reinstall VirtualBox\n\n\u003e [!WARNING]  \n\u003e If Vagrant gets stuck on the following line after executing `vagrant up`:  \n\u003e __`SSH auth method: private key`__\n\u003e\n\u003e * Windows users: Open cmd as admin and execute:\n\u003e    ```\n\u003e    bcdedit /set hypervisorlaunchtype off\n\u003e    ```\n\u003e   This disables [Hyper-V](https://es.wikipedia.org/wiki/Hyper-V).\n\n\u003e [!WARNING]  \n\u003e For __other issues__:\n\u003e\n\u003e * Visit the [VirtualBox Common Issues](https://developer.hashicorp.com/vagrant/docs/providers/virtualbox/common-issues) section of the Vagrant documentation\n\n## Steps to run the environment\n\nAll the `vagrant` commands must be executed in the host machine from the folder\nthat contains the Vagrantfile (in this case, the project root folder).\n\n\u003e [!NOTE]  \n\u003e __For Windows users:__  \n\u003e If Vagrant doesn't show any output in the stdout for a Vagrant command after some time,\n\u003e press the Enter key or right click in the console window.\n\u003e See [this post](https://superuser.com/questions/1442941/windows-10-console-stops-running-if-i-click-in-the-console-window) for more info about this problem.\n\n### 1. Start the VM [host]\n\nThis will:\n1. Install Docker inside the VM\n2. Pull the Docker images from DockerHub\n3. Run the containers\n\nAll with the corresponding port mappings.\n\n\u003e [!NOTE]  \n\u003e Docker images/containers will only be downloaded/executed if the\n\u003e `Docker Compose up` line in the `Vagrantfile` is uncommented.\n\n```bash\nvagrant up\n```\n\n### 2. Check the status of the VM [host]\n\n```bash\nvagrant status\n```\n\n### 3. Connect to the VM [host]\n\nThis connection is done via SSH.\n\n```bash\nvagrant ssh\n```\n\n\u003e [!TIP]  \n\u003e __Some interesting commands to execute inside the VM:__\n\u003e\n\u003e | Commmand                                  | Description                                                                                                                            |\n\u003e | ----------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------- |\n\u003e | `free -h`                                 | Display amount of free and used memory in the VM                                                                                       |\n\u003e | `docker stats`                            | Display a live stream of container(s) resource usage statistics. \u003cbr /\u003e Useful to monitor Docker containers memory usage.              |\n\u003e | `docker container ls --all`               | List all Docker containers (running or not). \u003cbr /\u003e If both containers specify \"Up\" in the status column, everything is running fine.  |\n\u003e | `docker logs \u003ccontainerid\u003e`               | Fetch the logs of a container. \u003cbr /\u003e Really useful to see what's going on.                                                            |\n\u003e | `docker top \u003ccontainerid\u003e`                | Display the running processes of a container                                                                                           |\n\u003e | `docker exec -it \u003ccontainerid\u003e \u003ccommand\u003e` | Run a command in a running container (in interactive mode)                                                                             |\n\u003e | `docker images`                           | List images                                                                                                                            |\n\u003e | `docker version`                          | Show the Docker version information                                                                                                    |\n\u003e | `docker info`                             | Display system-wide information                                                                                                        |\n\u003e | `netstat -tulpn \\| grep LISTEN`           | Display network connections (listening TCP or UDP). \u003cbr /\u003e Useful to check that Jupyter port (8888) is listening.                      |\n\n### 4. Create tmux session [vm]\n\nThe VM welcome message shows the command for connecting to the tmux session.\n\nThe tmux window is divided in panes with the following layout:\n\n```\n┌─────────────────┬──────────────────────────┐\n│    LINUX CLI    │                          │\n├─────────────────┤ IPYTHON 3.10 INTERPRETER │\n│ JUPYTER-LAB URL │                          │\n└─────────────────┴──────────────────────────┘\n```\n\n### 5. Access JupyterLab in your web browser [host]\n\nThe URL for accesing JupyterLab will be shown in the `JUPYTER-LAB URL` pane of the tmux session.\n\nSimply copy that URL and paste it in your web browser.\n\n\u003e [!NOTE]  \n\u003e It can also be obtained executing the following command:\n\u003e ```bash\n\u003e docker logs vagrant-python-1 2\u003e\u00261 | grep -o '[^ ]*127.0.0.1[^ ]*'\n\u003e ```\n\n### (Optional) Detach from tmux session [vm]\n\n```bash\nCtrl-B + d\n```\n\n### (Optional) Attach again to tmux session [vm]\n\n```bash\ntmux list-sessions\ntmux attach-session -t \u003csession-name\u003e\n```\n\nIf the tmux session is deleted (for example, using Ctrl-D several times), you may need to restart the tmux server in\norder to be able to connect again to the tmux session:\n\n```bash\ntmux kill-server\ntmux attach-session -t \u003csession-name\u003e\n```\n\n### (Optional) Remove and start containers to clean data [vm]\n\n\u003e [!NOTE]  \n\u003e Only if containers where executed using Docker Compose.\n\nThis is useful if you want to clean the data inside the containers.\n\n```bash\ncd /vagrant\ndocker compose rm --stop --force\ndocker compose up -d\n```\n\n### (Optional) Connect to one of the Docker containers [vm]\n\nObtain the name of the container you want to connect to:\n```bash\ndocker container ls --all\n```\n\n\u003e The name is the last column.\n\nExecute the bash command in that container to connect to it:\n```bash\ndocker exec -it \u003ccontainer-name\u003e bash\n```\n\n### Stop the VM (keeps data) [host]\n\nStopping the VM will stop the Docker containers and turn off the VM.  \nAll the data is persisted inside the containers, and a subsequent turn on of the VM\n(and the containers) will have access to that data.\n\nStop the VM:\n```bash\nvagrant halt\n```\n\nCheck the status of the VM:\n```bash\nvagrant status\n```\n\nStart the VM and the containers again:\n```bash\nvagrant up\n```\n\n### Destroy the VM (removes data) [host]\n\nDestroying the VM will remove all the VM data, and therefore, the containers inside it.\n\nThis should be the option used if you do not want to keep the data,\nand you want to have a \"clean\" environment in the next turn on of the VM\n(because the VM and the containers will be created from scratch).\n\n```bash\nvagrant destroy\n```\n\n### Additional notes\n\nWhenever you change the `docker-compose.yml` file, you need to run `vagrant reload` to redefine the Vagrant box.\n\n## Jupyter project\n\n### IPython\n\nEnhanced interactive Python shell.\n\n* Documentation: https://ipython.readthedocs.io/en/stable/\n* Demo: https://www.pythonanywhere.com/try-ipython/\n* Installation: `pip install ipython`\n* Execution: `ipython`\n\n### JupyterLab\n\nThe latest web-based interactive development environment.\n\n* Documentation: https://jupyterlab.readthedocs.io/en/stable/\n* Demo: https://jupyter.org/try-jupyter/lab/\n* Installation: `pip install jupyterlab`\n* Execution: `jupyter lab`\n\n### Jupyter Notebook\n\nThe original web application for creating and sharing computational documents.\n\n* Documentation: https://jupyter-notebook.readthedocs.io/en/stable/\n* Demo: https://jupyter.org/try-jupyter/retro/notebooks/?path=notebooks/Intro.ipynb\n* Installation: `pip install notebook`\n* Execution: `jupyter notebook`\n\n### Voilà\n\nRuns the code in the Jupyter notebooks and transforms them to standalone web applications and dashboards.\n\n* Documentation: https://voila.readthedocs.io/en/stable/index.html\n* Demo: https://mybinder.org/v2/gh/voila-dashboards/voila/stable?urlpath=voila%2Ftree%2Fnotebooks\n* Installation: `pip install voila`\n* Execution:\n  - To use Voilà within a pre-existing Jupyter server, first start the server, then go to the following URL: `\u003curl-of-my-server\u003e/voila`\n  - For example, if you typed jupyter lab and it was running at http://localhost:8888/lab, then Voilà would be accessed at http://localhost:8888/voila.\n\n## References\n\n* [Vagrant](https://www.vagrantup.com/)\n* [Docker](https://www.docker.com/)\n* [Vagrant Docker provisioner](https://www.vagrantup.com/docs/provisioning/docker)\n* [Jupyter base-notebook + python-3.10 Docker image](https://hub.docker.com/layers/jupyter/base-notebook/python-3.10/images/sha256-9258c7fbbcd0fd7f4c314f71285f1e42920673231673349105e5af8f8a8bf7bb)\n* [Vagrant commands](https://www.vagrantup.com/docs/cli)\n* [Docker commands](https://docs.docker.com/engine/reference/commandline/docker/)\n* [Docker Compose commands](https://docs.docker.com/compose/reference/)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcarlossanabriam%2Fvagrant-docker-python3","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcarlossanabriam%2Fvagrant-docker-python3","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcarlossanabriam%2Fvagrant-docker-python3/lists"}