linux - How to deploy a Docker image to make changes in the local environment? -


edit +2=just fyi, root user means not have type out superuser (sudo) every time authorized cmd.

alright after 24 hours of researching docker little upset if got facts straight.

as quick recap, docker serves way write code or configuration file changes specific web service, run environment, virtual machines, cozy confines of linux terminal/text file. beyond doubt amazing feature: have code or builds made on 1 computer work on unlimited number of other machines breakthrough. while annoyed terminology wrong respect whats containers , images (images save points of layers of code made dockers servers or can created containers require base image go off of. dockerfiles serve way automate build process of making images running desired layers , roll them 1 image can accessed easily.).

see catch docker "sure can deployed on variety of different operating systems , use respective commands". commands not come pass on local environment though. while running tests on dockerbuild working centos, basic command structure goes

from centos run yum search epel run yum install -y epel-release.noarch run echo epel installed! 

so works within docker build , says succesfully installs it. same can said ubuntu running apt-cache instead of yum. going centos vm, not state epel has been installed because when attempting run command of

yum remove epel-release.noarch 

it says "no packages removed yet there package named ...". then, if docker able multi-platform why can not create changes on local platform/image targeting? docker builds run simulation of going happen on particular environment can not seem make come pass. defeats 1 of intended purposes of docker if can not change local system 1 using, unless missing something.

please let me know if has solution dilemma.

edit +1=ok figured out yesterday trying view , modify container can done doing either docker logs containerid or docker run -t -i img /bin/sh put me interactive shell make container changes there. still, want know if theres way make docker comunicate local environment within container.

so, think may have largely missed point behind docker, management of containers intentionally isolated local environment. idea create containerized applications can run on docker host without needing worry particular os installed or configuration of host machine.

that said, there variety of ways break isolation if that's want do.

you can start container --net=host (and --privileged) if want able modify host network configuration (including interface addresses, routing tables, iptables rules, etc).

you can parts of (or of) host filesystem volumes inside container using -v command line option. example, docker run -v /:/host ... expose root of host filesystem /host inside container.

normally, docker containers have own pid namespace, means processes on host not visible inside container. can run container in host pid namespace using --pid=host.

you can combine these various options provide or little access host need accomplish particular task.

if you're trying install packages on host, container wrong tool job.


Comments

Popular posts from this blog

PHP DOM loadHTML() method unusual warning -

python - How to create jsonb index using GIN on SQLAlchemy? -

c# - TransactionScope not rolling back although no complete() is called -