Wednesday, October 24, 2018

Build Own Image with Dockerfile

Create Dockerfile
> mkdir mywork

> vi Dockerfile
# Build own ubuntu with Dockerfile

FROM ubuntu
MAINTAINER rayrosliabas@gmail.com

RUN apt-get install -y mlocate
# RUN ["/bin/bash"]

CMD ["echo","Welcome to my Ubuntu"]

Build image name as "my_ubuntu",  dockerfile location c:\mywork\
> docker build -t my_ubuntu c:\mywork\

List images created
> docker images
REPOSITORY                 TAG                 IMAGE ID            CREATED              SIZE
my_ubuntu                 ver.1          6cee799c3ba7        About a minute ago   110MB
ubuntu                     latest              ea4c82dcd15a        5 days ago           85.8MB

Test Run
>docker run -it my_ubuntu
Welcome to my Ubuntu

Notes:
-if using CMD, image will run, execute echo, then terminated.
-if using RUN /bin/bash, image will login into container server

2 Comments:

Blogger RayRosli Abas said...

This comment has been removed by the author.

3:24 PM  
Blogger RayRosli Abas said...

https://next.tweakboxapp.com/

4:24 PM  

Post a Comment

<< Home