A memo on how to easily prepare a Linux exercise environment

A memo when preparing an environment for practicing Linux commands for those who have never hit Linux commands

Main requirements and situations

・ I want to prepare easily ・ I don't want you to incur additional costs (preparation costs including pure machine usage fees) ・ Only one Linux machine at hand can be used I don't want you to troll because it's a machine I use regularly

Conclusion

By preparing a Linux environment with a Docker container, prepare an environment where you can work except for some privileged operations.

Create a docker-compose file like the one below and prepare a container that can use centos. The centos / tools: latest image is an image of centos with basic tools. In the case of a normal centos image, it is necessary to install a separate tool because it is in a minimal state, so use this.

docker-compose.yml


services:
  cent:
    image: centos/tools:latest
    container_name: cent
    tty: true

After that, create an appropriate Linux user and make it belong to the docker group. All you have to do is hit the docker exec command to access the container.

I'm a little reluctant to give up the docker group, so it might be better to open the container's ssh port to connect.

How to execute a command that requires privilege (uninvestigated)

It seems that privileged commands can also be used by using privileged and / sbin / init as shown below. In this case, I avoided using it because I wanted to reduce the influence on the host machine side, but I would like to use this method if the machine does not matter. docker run -it -d --privileged --name centos7 centos:7 /sbin/init

Recommended Posts

A memo on how to easily prepare a Linux exercise environment
How to build a Python environment on amazon linux 2
How to build Java environment on Ubuntu (Linux)
How to install Linux on a 32bit UEFI PC
How to build a Django (python) environment on docker
How to build a new python virtual environment on Ubuntu
How to install VMware-Tools on Linux
A note on how to load a virtual environment in PyCharm
Create a Linux environment on Windows 10
How to develop in a virtual environment of Python [Memo]
How to create a Python 3.6.0 environment by putting pyenv on Amazon Linux and Ubuntu
[Linux] How to install a package on a server that does not have a network environment (standalone)
How to set up WSL2 on Windows 10 and create a study environment for Linux commands
How to customize U-Boot with OSD335X on a custom board (memo)
How to build a Python environment using Virtualenv on Ubuntu 18.04 LTS
How to install aws-session-manager-plugin on Manajro Linux
How to build a sphinx translation environment
How to update php on Amazon linux 2
How to prepare Python development environment [Mac]
How to display emoji on Manjaro Linux
How to install packages on Alpine Linux
How to install Anisble on Amazon Linux 2
How to update security on CentOS Linux 8
How to install php7.4 on Linux (Ubuntu)
How to test on a Django-authenticated page
How to run Cython on OSX Memo
How to find large files on Linux
How to easily switch the virtual environment created by Conda on Jupyter
Linux screen distribution on Ubuntu Memo that wants to be a Linux screen distribution YouTuber
Verification of how to periodically execute a script on a Linux server on Windows
Build Linux on a Windows environment. Steps to install Laradock and migrate
How to share a virtual environment [About requirements.txt]
How to create a Python virtual environment (venv)
[Latest] How to build Java environment on Ubuntu
Try to create a new command on linux
How to create a shortcut command for LINUX
How to live a decent life on 2017 Windows
[Note] How to create a Ruby development environment
How to install Camunda Modeler on Manjaro Linux
[Note] How to create a Mac development environment
How to quickly create a morphological analysis environment using Elasticsearch on macOS Sierra
How to access the contents of a Linux disk on a Mac (but read-only)
LINUX: How to make arrow keys correspond to 2,4,6,8 on a notebook without a numeric keypad
How to run a Django application on a Docker container (development and production environment)
How to prepare an environment with different python version and package for each project with pyenv-virtualenv on Amazon Linux
A memo to create a virtual environment (venv) before Django
A memo of how to use AIST supercomputer ABCI
How to set up a Python environment using pyenv
How to use C216 Audio Controller on Arch Linux
How to deploy a Django application on Alibaba Cloud
A memorandum on how to use keras.preprocessing.image in Keras
How to allow nologin users to log in on Linux
I want to easily build a model-based development environment
How to create a local repository for Linux OS
How to build a development environment for TensorFlow (1.0.0) (Mac)
[AWS EC2] How to install Maven on Amazon Linux 2
Introducing a desktop environment to Arch Linux (LightDM + Xfce4)
How to install git on Linux such as EC2
How to run Django on IIS on a Windows server
[Tips] How to use iPhone as webcam on Linux
How to operate Firefox with selenium on Windows Memo