GithubHelp home page GithubHelp logo

df's Introduction

Dockerfile

一、手工构建Docker镜像

启动并进入容器模板

docker run -t -i --name=tpl ubuntu:18.04 bash

安装软件包

apt-get update &&\
apt-get install -y sudo vim &&\
apt-get clean

新建用户并赋予无密码超级权限

useradd -m openwrt &&\
echo 'openwrt ALL=NOPASSWD: ALL' > /etc/sudoers.d/openwrt

退出容器回到本机

exit
docker diff tpl #查看该容器进行了哪些修改

提交镜像

docker commit -m "ubuntu 18.04" tpl yinping/ubuntu:18.04

使用镜像

docker run -t -i --name=tpl yinping/ubuntu:18.04 sudo -iu openwrt bash
docker attach tpl
docker exec -ti tpl sudo -iu openwrt bash

退出bash

  1. Ctrl + d 退出并停止容器
  2. Ctrl + p + q 退出并在后台运行容器

推送镜像到仓库

docker login --username=yinping
docker push yinping/ubuntu:18.04

二、Dockerfile构建

docker build --rm -t yinping/ubuntu:18.04 .

df's People

Contributors

qq179055016 avatar renyinping avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.