Always need clear Ubuntu OS environment for test.
So, Quickly deploy an environment is important.
You will need the following things:
- Updated MAC with Mojave
- Install docker in MAC
- Clone Sample Dockerfile (here)
Switch directory with dockerfile & build image
docker build -t [ImageName] .
Check Docker Images
wn.lin:~/ $ docker images REPOSITORY TAG IMAGE ID CREATED SIZE ubuntu_16.04_base latest 02bc891808b1 10 days ago 279MB ubuntu 16.04 b0ef3016420a 4 weeks ago 117MB
Starting docker instance with Images: ubuntu_16.04_base
docker run -d -P --name [DockerName] --hostname [DockerHostname] [DockerImageName]
Check Docker Instance
wn.lin:~/ $ docker ps -a CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES f8daeda00ef5 ubuntu_16.04_base "/usr/sbin/sshd -D" 10 days ago Up 7 seconds 0.0.0.0:32768->22/tcp ubuntu-new
Login into docker instance by port
#ssh root@localhost -p32768
Login permissions are written in the dockerfile
wn.lin:docker/ $ cat Dockerfile| grep -i root RUN echo 'root:rootpwd' | chpasswd
Enjoy it.