・ 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
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.
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