在docker文件中,像这样命名图像有什么用...
FROM <image> [AS <name>]
我从文档中发现的一种用途是-
- Optionally a name can be given to a new build stage by adding
AS name to the FROM instruction. The name can be used in subsequent
FROM and COPY --from=<name|index> instructions to refer to the image
built in this stage.
还有其他用途吗?
答案 0 :(得分:1)
名称/别名只是在另一个阶段中引用特定阶段的一种方式。因此,如果您使用的是普通版本,则无需使用它。否则,您将使用索引号,例如:
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
RecyclerviewAdapter.updateActivity(this);
imageEmptyLayout = findViewById(R.id.empty_img_layout);
context = getApplicationContext();
uContext = this;
getSupportActionBar().setTitle("Kitchen Display");
handler = new Handler();
db=new DbHelper(context);
createList();
runnableCode.run();
db.InsertDataViaSocket(uContext);
isEmpty(imageEmptyLayout);
}
Runnable runnableCode = new Runnable() {
@Override
public void run() {
expandableListView=findViewById(R.id.expandable_lv);
// listAdapter=new ExpandableListAdapter(context,listDataHeader,listHashMap,null,i);
for(int i=0;i<kotNeeds.size();i++){
kotNeeds.get(i).setWaitingTime(calWaitingTime(kotNeeds.get(i).getDate_time()));
// listAdapter=new ExpandableListAdapter(context,kotNeeds.get(i).getListKey_id(),kotNeeds.get(i).getExp_item(),kotNeeds,i);
}
// listAdapter.notifyDataSetChanged();
myadapter.notifyDataSetChanged();
handler.postDelayed(this, 1000);
}
};
public void createList(){
reobj=new RecyclerviewObjectPass(context);
kotItems=new ArrayList<>();
kotNeeds=new ArrayList<>();
hashMap1=new HashMap<>();
kotItems=db.getNeedsItems();
for(i=0;i<kotItems.size();i++){
KotNeeds kotNeeds1=new KotNeeds();
kotNeeds1.kotNo=kotItems.get(i).getKotNo();
kotNeeds1.inv_no=kotItems.get(i).getInv_no();
kotNeeds1.listHeader=kotItems.get(i).getItem_name();
//kotNeeds1.date_time=kotItems.get(i).getDate_time();
kotNeeds1.date_time=kotItems.get(i).getDate_time();
System.out.println("g9g9 "+calWaitingTime(kotItems.get(i).getDate_time()));
kotNeeds1.setNewItem(kotItems.get(i).getNewItem());
kotNeeds1.setCancelItem(kotItems.get(i).getCancelItem());
kotNeeds1.listKey_id=kotItems.get(i).getItem_key_val();
System.out.println("dfdf "+kotItems.get(i).getNewItem() + " "+ kotItems.get(i).getCancelItem());
System.out.println( kotNeeds1.listHeader+"dsssssssssssss"+i);
List<String> comments=kotItems.get(i).getComment_b();
System.out.println( comments+"dsssssssssssss"+i);
for(int j=0;j<kotNeeds1.listKey_id.size();j++){
if(comments.get(j)!=null){
String comment=comments.get(j);
System.out.println(comment+"dsssssssssssss"+j);
String[] allIdsArray = TextUtils.split(comment, ",");
ArrayList<String> idsList = new ArrayList<String>(Arrays.asList(allIdsArray));
hashMap1.put(kotNeeds1.listKey_id.get(j),idsList);
}
}
kotNeeds1.exp_item=hashMap1;
kotNeeds.add(kotNeeds1);
System.out.println("QWQW " + calWaitingTime(kotItems.get(i).getDate_time())+" "+i);
}
LinearLayoutManager layoutManager = new LinearLayoutManager(this, LinearLayoutManager.HORIZONTAL, false);
myrv = findViewById(R.id.recyclerview_id);
reobj.setMyrvobj(myrv);
myrv.setLayoutManager(layoutManager);
myadapter = new RecyclerviewAdapter(this, kotNeeds);
//myrv.setLayoutManager(new GridLayoutManager(this, setColumn()));
myrv.setAdapter(myadapter);
myadapter.notifyDataSetChanged();
}
public void updateTime(){
for(int i = 0; i<kotNeeds.size();i++){
KotNeeds kot = new KotNeeds();
System.out.println("s8s8 "+calWaitingTime(kotNeeds.get(i).date_time));
kotNeeds.set(i,kot);
}
}
@Override
protected void onResume() {
super.onResume();
}
public void isEmpty(RelativeLayout view){
if(db.getNeedsItems().size()>0){
view.setVisibility(View.GONE);
// handler.post(runnableCode);
}
}
public String calWaitingTime(String dateStart) {
long diffSeconds = 0,diffMinutes = 0,diffHours = 0,diffDays = 0;
String fTime = "";
//String dateStart = "08/11/2016 09:29:58";
//String dateStop = "08/12/2016 10:31:48";
//HH converts hour in 24 hours format (0-23), day calculation
SimpleDateFormat format = new SimpleDateFormat("MM/dd/yyyy HH:mm:ss");
Date d1 = null;
Date d2 = null;
try {
d1 = format.parse(dateStart);
d2 = new Date();
//in milliseconds
long diff = d2.getTime() - d1.getTime();
diffSeconds = diff / 1000 % 60;
diffMinutes = diff / (60 * 1000) % 60;
diffHours = diff / (60 * 60 * 1000) % 24;
diffDays = diff / (24 * 60 * 60 * 1000);
if(diffMinutes<=0){
fTime = diffSeconds+"";
}else if(diffHours<=0){
fTime = diffMinutes+" : "+diffSeconds;
}else{
fTime = diffHours+" : "+diffMinutes+" : "+diffSeconds;
}
System.out.println(diffDays + " days, ");
System.out.println(diffHours + " hours, ");
System.out.println(diffMinutes + " minutes, ");
System.out.println(diffSeconds + " seconds. pppp");
} catch (Exception e) {
e.printStackTrace();
System.out.print(e + " seconds. pppp");
}
return fTime;
}
该名称也可以与 with cte (
SELECT e.Fname, e.Lname, AVG(Hours) AS avgHours, d.Dnumber as department
FROM EMPLOYEE AS e
INNER JOIN DEPARTMENT AS d ON e.Dno = d.Dnumber
INNER JOIN Project AS p ON p.Dnum = d.Dnumber
INNER JOIN WORKS_ON AS w ON w.Pno = p.Pnumber
GROUP BY e.Fname, e.Lname
)
select max(avgHours) from cte group by department
option to the build command结合使用,例如:
FROM <image_image>
RUN <do_something>
...
FROM <image_name>
COPY --from=0 <files_to_copy> <destination>
...
--target