docker添加新的环境变量_在Dockerfile中,如何更新PATH环境变量?

I have a dockerfile that download and builds GTK from source, but the following line is not updating my image's environment variable:

RUN PATH="/opt/gtk/bin:$PATH"

RUN export PATH

I read that that I should be using ENV to set environment values, but the following instruction doesn't seem to work either:

ENV PATH /opt/gtk/bin:$PATH

This is my entire Dockerfile:

FROM ubuntu

RUN apt-get update

RUN apt-get install -y golang gcc make wget git libxml2-utils libwebkit2gtk-3.0-dev libcairo2 libcairo2-dev libcairo-gobject2 shared-mime-info libgdk-pixbuf2.0-* libglib2-* libatk1.0-* libpango1.0-* xserver-xorg xvfb

# Downloading GTKcd

RUN wget http://ftp.gnome.org/pub/gnome/sources/gtk+/3.12/gtk+-3.12.2.tar.xz

RUN tar xf gtk+-3.12.2.tar.xz

RUN cd gtk+-3.12.2

# Setting environment variables before running configure

RUN CPPFLAGS="-I/opt/gtk/include"

RUN LDFLAGS="-L/opt/gtk/lib"

RUN PKG_CONFIG_PATH="/opt/gtk/lib/pkgconfig"

RUN export CPPFLAGS LDFLAGS PKG_CONFIG_PATH

RUN ./configure --prefix=/opt/gtk

RUN make

RUN make install

# running ldconfig after make install so that the newly installed libraries are found.

RUN ldconfig

# Setting the LD_LIBRARY_PATH environment variable so the systems dynamic linker can find the newly installed libraries.

RUN LD_LIBRARY_PATH="/opt/gtk/lib"

# Updating PATH environment program so that utility binaries installed by the various libraries will be found.

RUN PATH="/opt/gtk/bin:$PATH"

RUN export LD_LIBRARY_PATH PATH

# Collecting garbage

RUN rm -rf gtk+-3.12.2.tar.xz

# creating go code root

RUN mkdir gocode

RUN mkdir gocode/src

RUN mkdir gocode/bin

RUN mkdir gocode/pkg

# Setting the GOROOT and GOPATH enviornment variables, any commands created are automatically added to PATH

RUN GOROOT=/usr/lib/go

RUN GOPATH=/root/gocode

RUN PATH=$GOPATH/bin:$PATH

RUN export GOROOT GOPATH PATH

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值